$results = User::where(function($q) use ($request) {
$q->orWhere('email', 'like', '%john@example.org%');
$q->orWhere('first_name', 'like', '%John%');
$q->orWhere('last_name', 'like', '%Doe%');
})->toSql();
dd($results)
result
select * from `users` where (`email` like ? or `first_name` like ? or `last_name` like ?)
yang ke dua masuk app routes.php
\DB::listen(function($sql) {
var_dump($sql);
});
Tidak ada komentar :
Posting Komentar