Laravel run artisan command from controller

2020-10-31 13:19:05 Anil Singh Laravel

In this trick you will see how to run artisan command from laravel controller


In routes/web.php


Route::get('/run-artisan-command-xyz','MyController@runArtisanCommand');


In your Controller


public function runArtisanCommand(){

	\Artisan::call('command:name', ['--option' => 'foo']);
}


This post is submitted by one of our members. You may submit a new post here.

Related Tricks