Escape raw SQL queries in Laravel 4

后端 未结 7 966
别那么骄傲
别那么骄傲 2020-12-15 16:23

How does one go about escaping parameters passed to a raw query in Laravel 4? I expected something like DB::escape() (which rings a bell from Laravel 3) and als

7条回答
  •  醉梦人生
    2020-12-15 16:35

    Here's a fuller example, showing how to escape both values and columns and extend Laravel's querybuilder:

    getGrammar();
                return $this->whereRaw('FIND_IN_SET(?,' . $grammar->wrap($columnName) . ')', [$value]);
            });
        }
    }
    

提交回复
热议问题