Boot the application in your file so you will have access to everything.
Adding facades to custom php file
Hello forum. I have just joined LaraCast, and got to say it is amazing! So this will be my first question, and i hope some lovely guy or girl might be able to help me out with this little pickle of mine.
I have a custom .php file in my project (app\Folder\File.php), it is running a while loop, doing some stuff every 30 seconds. I am running it from my terminal using the
php -q app/Folder/File.php
But i want to be able to access facades in there, like Auth::, Redis:: and other stuff. I have no idea how to declare this properly, as i keep getting a "A facade root has not been set" error, when using the following:
use Illuminate\Support\Facades\Redis as Redis;
Any help would really be appreciated on this!
Create a laravel console command - https://laravel.com/docs/master/artisan and move there your code from app\Folder\File.php. So you will be able to run in from console and will have access to all laravel stuff
Please or to participate in this conversation.