laravel use sql code example
Example 1: laravel to sql
DB::table('users')->toSql()
Example 2: laravel sql query
use Illuminate\Support\Facades\DB;
$users = DB::select('select * from users');
foreach ($users as $user) {
echo $user->name;
}
DB::table('users')->toSql()
use Illuminate\Support\Facades\DB;
$users = DB::select('select * from users');
foreach ($users as $user) {
echo $user->name;
}