I have schedule like this
$schedule->call(function () {
$mial->getMail(Auth::user()->id);
})->everyMinute();
show me this
You cannot check auth
via the command line as a command does not have any information about the session. It is not concerned with HTTP / a browser at all
You can't do that because a user doesn't run the scheduled command, so auth()->user()
object will always be null
.
To fix this, you can save user ID in DB and fetch the data on scheduled command execution.