I have some query that I need to pass to another query using query builder
$query = DB::table(\'table\')->whereIn(\'some_field\', [1,2,30])->toSql();
Mode
Laravel now offers debugging directly on your Builder!!!
https://laravel.com/docs/queries#debugging
\App\User::where('age', '18')->dump();
\App\User::where('age', '18')->dd();
Outputs
"select * from `users` where `age` = ?"
[
0 => "18"
]
Check out the getBindings()
method on the Builder
class
getBindings()
$query = DB::table('table')->whereIn('some_field', [1,2,30]);
$sql = $query->toSql();
$bindings = $query->getBindings();