Make call to commands direct artisan of code [closed]

1

Hello! I am studying laravel, and would like to know if it is possible to call the artisan commands in the Controllers. Example: When the user clicks the button he executes an artisan command, a routine or something related.

    
asked by anonymous 19.12.2016 / 13:03

1 answer

1

Laravel version missing but at least in 5.1 you can use the artisan's facade

use Illuminate\Support\Facades\Artisan;

and within the function:

Artisan::call('down');

In the example I gave Laravel was put into maintenance mode.

    
19.12.2016 / 13:10