Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Artisan Command from laravel 4.2 Controller

I am trying to execute some custom artisan command from controller like

Artisan::call('php artisan MyCustomCommand');

but it works fine when I execute

php artisan MuCustomCommand from CLI.

I have registered command in app/start/artisan.php. Even Artisan::call('php artisan --help'); is not working.

like image 400
suresh726 Avatar asked Feb 01 '16 07:02

suresh726


1 Answers

You should run artisan command like this from your controller . Example :

 Artisan::call('migrate:install');

So Instead of doing Artisan::call('php artisan MyCustomCommand');

You should do

Artisan::call('MyCustomCommand');

Here is the documentation

Hope it helps :)

like image 180
Drudge Rajen Avatar answered Sep 28 '22 06:09

Drudge Rajen