I'm using laravel 5.8 and created a command that runs in the background to keep data updated.
web.php
Route::get('/admin/do_stuff', function () {
Artisan::call('do:stuff');
return 'Started!';
});
DoStuff.php
while(config('key.value')){
doStuff();
sleep(120);
}
Also got my route (mysite.com/admin/do_stuff) that will start this process, but now I want to add a new route (mysite.com/admin/stop_doing_stuff) to be able to stop it. I've seen in the documentation config variables could be set during runtime https://laravel.com/docs/5.8/configuration#accessing-configuration-values but this doesn't seem to be changing the value at all. Is this possible?
Reading the value from the .env file seems to work but that means I need to edit that file manually and that's not an option, also I could store the value in the database but would like to not doing it. Tried clearing the config cache but getting the same result
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3c3Qq8s
via IFTTT
Aucun commentaire:
Enregistrer un commentaire