且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检查Laravel时间表上的身份验证

更新时间:2023-12-06 15:53:16

您无法执行此操作,因为用户未运行计划的命令,因此auth()->user()对象将始终为null.

You can't do that because a user doesn't run the scheduled command, so auth()->user() object will always be null.

要解决此问题,您可以将用户ID保存在DB中,并在计划的命令执行时获取数据.

To fix this, you can save user ID in DB and fetch the data on scheduled command execution.