如何获取由管理员运行的事件的查询日志
我想获取由我网站的每个管理员运行的所有查询。
我的意思是,我需要获取他们正在运行查询以及其用户ID和IP地址的页面的URL。
但是为此,我不想使用控制器方法。
我需要作为中间件执行此操作,并将其应用于所有管理路线。
那我该怎么做呢?
您能为我提供一些有关此的提示或指南吗?
I want to get all the queries that run by each Admin of my website.
I mean I need to get the url of the page that they're running query and also their user id and ip address.
But for doing this, I don't want to use Controller methods.
I need to do this as Middleware and apply it to all admin routes.
So how can I do this?
Would you please provide me some tips or guidelines about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在第一个流中,您必须使用此命令创建自定义中间件
,然后在内核文件中添加中间路由: - app>> http>> kernel.php
将其添加到$ utaremiddleware阵列
之后,此之后,将此管理路由中间件添加到我们的路由中,
您可以将逻辑放入此控制器中,因此,每当从该路由中的任何路由从此路线中调用任何路由时,请先致电我们的中间件
以获取更多说明,以获取以下链接:
https://laravel.com/docs/docs/9.x/middleware
In the first flow, you have to create a custom middleware using this command
Then add middle route in kernal file :- app >> Http >> Kernel.php
Add this in $routeMiddleware array
after that add this admin route middleware to our route
You can put your logic in this controller, so whenever any route call from this inside this route first call our middleware
For more explanation reference the below link :
https://laravel.com/docs/9.x/middleware
https://appdividend.com/2022/01/23/laravel-middleware/