1DB::enableQueryLog(); // Enable query log
2
3// Your Eloquent query executed by using get()
4
5dd(DB::getQueryLog()); // Show results of log
1use Illuminate\Support\Facades\DB;
2
3$users = DB::select('select * from users');
4
5foreach ($users as $user) {
6 echo $user->name;
7}
1/**
2 * Combines SQL and its bindings
3 *
4 * @param \Eloquent $query
5 * @return string
6 */
7public static function getEloquentSqlWithBindings($query)
8{
9 return vsprintf(str_replace('?', '%s', $query->toSql()), collect($query->getBindings())->map(function ($binding) {
10 $binding = addslashes($binding);
11 return is_numeric($binding) ? $binding : "'{$binding}'";
12 })->toArray());
13}
1<!DOCTYPE html>
2 <html>
3<head> </head>
4
5<body> This should </body>
6<br><br><br><br>
7<form method="post">
8<button type="button"> submit </button>
9</form>
10</html>
11