vendredi 18 décembre 2020

Running commands from Controller async

There is a migration task. User uploads file to the server, then it should be saved and migration command should be run async. The first path works well, there is an issue with the second part. I've tried to put all code to console command and run it with

Artisan::call('user:migrate', ['user_id' => $userId]);

or

Artisan::queue('user:migrate', ['user_id' => $userId]);

the script works, but not async, controller's function waits for the end. Also I've tried to create a Job and call it via:

$this->dispatch(new UserMigration($user));

and had the same result, script works but not async. Please help to realize how queues work and that approach is better for my task. I've not created any queue migrations and configuration, because need this step just async calling.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3nAmZkP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire