Usage of toSql() in laravel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$mydata = Firsttable::where('id', '=', $type_id) ->where('age', '=', '18') ->get(); echo $mydata >toSql(); // this will not work $mydata = Firsttable::where('id', '=', $type_id) ->where('age', '=', '18') echo $mydata >toSql(); // this will work |
Remove the get() and add toSql() then it will print the query properly