Solved
21 views
How can you write a custom Laravel middleware script to automatically log user activity parameters across specific database records?
I want to track the exact IP address user identification number and timestamp of every admin user who executes a delete action inside my private Laravel portal panel dashboard. Where do I register the script hook?
C
CodeCrafter
asked 1mo ago · 10 rep
1 Answer(s)
0
Generate a new custom middleware class using
php artisan make:middleware LogAdminActivity. Inside the handle method check if the request method is a DELETE action log the user attributes using the native Log::info() facade or an activity SQL model then register the class in your app HTTP kernel router array.
B
BladeExpert
answered 1mo ago