'Laravel run package artisan command in controller

I need to run this command when user change something in translation file

php artisan export:messages-flat

I need to add it in may controller

so I'm using this code

\Artisan::call('export:messages-flat');

but it return error saying that

The command "export:messages-flat" does not exist.

but when I

php artisan list

enter image description here

it's in the list

I also try to run other command

\Artisan::call('cache:clear');

and it works

this is the package I'm using link

kindly help me, sorry for may poor english



Solution 1:[1]

The package only allows you to run the commands from the CLI. You can see from the source code, they only register the Artisan commands if the application is running from the console.

As an alternative, you can call ExportLocalization::export()->toFlat() according to their documentation.

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 waterloomatt