How to get last executed mysql query in laravel?

Posted by LaravelIndia - 3 years ago

Example 1:

public function querylog()
{
    DB::enableQueryLog();
    $product = Product::find(2);
    $last_query = DB::getQueryLog();
    dump($last_query);
}