laravel query last code example
Example 1: print last query laravel
DB::enableQueryLog();
dd(DB::getQueryLog());
Example 2: print last sql query laravel
DB::enableQueryLog(); // Enable query log
// Your Eloquent query executed by using get()
dd(DB::getQueryLog()); // Show results of log
Example 3: laravel get last record
Model::latest()->first();
Example 4: laravel get last record
return DB::table('files')->order_by('upload_time', 'desc')->first();