Answers for "Eloquent get SQL"

PHP
6

print last sql query laravel

DB::enableQueryLog(); // Enable query log

// Your Eloquent query executed by using get()

dd(DB::getQueryLog()); // Show results of log
Posted by: Guest on May-09-2020
1

laravel get sql query eloquent with parameters

$query->toSql();

$query->getBindings()
Posted by: Guest on February-12-2021
2

DB: in eloquent using sql

$results = DB::select('select * from users where id = :id', ['id' => 1]);
Posted by: Guest on June-11-2020

Browse Popular Code Answers by Language