1

I have a question about Laravel.

Is there any way to get the query that laravel run when dealing with models? Example To do an insertion in the table product I do so:

    *$Product = new product;
     $Product-> id = $ idTemp;
     $Product-> name = $ request-> Name;
     $Product-> save ();*

And I would like to get the query: Insert into table product values (...) It is for an audit class or something like that I tried with querylog but it doesnt return anything I hope it helps you

  • 1
    You can use event listeners for this - https://laravel.com/docs/5.4/eloquent#events – Styphon Jun 14 '17 at 16:12
  • 2
    Possible duplicate of [How to get the query executed in Laravel 5 ? DB::getQueryLog returning empty array](https://stackoverflow.com/questions/27753868/how-to-get-the-query-executed-in-laravel-5-dbgetquerylog-returning-empty-arr) – apokryfos Jun 14 '17 at 16:17

0 Answers0