0

I have a model class query

my code

  $jobs = \App\Job::orderBy('created_at', 'DESC')->offset($start)->limit($length)->get(); //supply start and length of the table data

I tried DB::enableQueryLog(); dd( DB::getQueryLog() );

but it is showing nothing

Peter
  • 777
  • 2
  • 13
  • 34
  • 3
    Possible duplicate of [Laravel query to sql query](https://stackoverflow.com/questions/44497115/laravel-query-to-sql-query) – RAUSHAN KUMAR Jun 20 '17 at 07:02
  • Checkout this post : https://stackoverflow.com/questions/27753868/how-to-get-the-query-executed-in-laravel-5-dbgetquerylog-returning-empty-arr – Pankaj Makwana Jun 20 '17 at 07:12

1 Answers1

0

Add the following to your somewhere before you run your query:

DB::listen(function($sql, $bindings, $time)
{
    dump($sql);
});

Depending on the namespace of where you put the above you might have to import the DB facade or simply change it to \DB.

Hope this helps!

Rwd
  • 34,180
  • 6
  • 64
  • 78