Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

run artisan commands in laravel controllers

/*
|=======================================================
| Run Artisan commands in laravel controllers
|=======================================================
*/
public function home()
{
     
  Artisan::call('cache:clear');
  echo "Cache Cleared <br>";

  Artisan::call('config:cache');
  echo "config cache are cleared <br>";

  Artisan::call('route:cache');
  echo "routes cache are cleared <br>";

  Artisan::call('optimize:clear');
  echo "optimized cleared <br>";

  Artisan::call('storage:link');
  echo "storage linked <br>";
}
 
PREVIOUS NEXT
Tagged: #run #artisan #commands #laravel #controllers
ADD COMMENT
Topic
Name
1+9 =