Friday, March 4, 2022

[FIXED] Error while running artisan command from controller

Issue

while running below artisan command from controller works fine

Artisan::call('backup:run');

but why this is not working

Artisan::call('backup:run --only-db');

it throws error The command "backup:run --only-db" does not exist.

through CLI it works fine

php artisan backup:db --only-db

Solution

I believe what you wanted to do is.

Artisan::call('backup:run',['--only-db'=>true]);


Answered By - rapulu

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.