Many times we needs to write static query in Laravel. Some time due to the complexity of the query or sometime due to the MYSQL build in functions not supported in the Query Builder or in Eloquent in Laravel example LPAD. Thus at that time Laravel provides us the facility to write static query and execute them without any issue. By using following syntax.
Syntax :-
$data = DB::select("SELECT * from table where id = {$id}");
0 Comment(s)