'Is it possible to use session from kernel console command in laravel?
I'm trying to fetch data from sessions when I run a command in my console, but session always returns an empty array!
php artisan command:mycommand
Below is how I'm trying to get the session:
//returns empty array
$session = session()->all();
Any ideas?
Solution 1:[1]
Session are used in the context of HTTP protocol. There is no such session using CLI. However, if your php artisan command is triggered in the context of an HTTP request, you could pass data to your command using arguments.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | jascar_destin |