fetch Raw Queries in Laravel code example
Example 1: show query in laravel
Use the toSql() method on a QueryBuilder instance.
DB::table('users')->toSql()
Example 2: raw queries in laravel
DB::statement('UPDATE users SET role_id = 1 WHERE role_id IS NULL AND YEAR(created_at) > 2020');