Save the audit trail for your model?

We need make a audit history for any model in your project

How i do this using " illuminate/database " ?

Hi What are you trying to log exactly for the audit history? All SQL queries?

i mean create audit history for ( create new or edit or delete )

like this :

I’m not sure if it helps. The documentation for Slim 3 contains a receipt for Eloquent. You just have to adapt it for Slim 4. If you just want to use the Laravel Query Builder you may look here. Maybe I write a blog about Eloquent and Slim 4. as you are using Eloquent, you could tap into the model events to queue an insert in model changes? This would probably be the easiest approach as Eloquent Model emit events anyway.

If you are using the DB facade then I would recommend using DB transactions and store the difference.

Obviously there are quite a few ways to achieve this, one I would recommend is a simple event sourcing route.

How i use Eloquent Event with my model can you make for me a sample one ?