Laravel execute artisan commands from controller
Commands for clear application cache
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan clear-compiled
php artisan config:cache
Call above commands in controller
<?php
public function callArtisanCommands(){
Artisan::call('cache:clear');
Artisan::call('view:clear');
Artisan::call('route:clear');
Artisan::call('config:clear');
Artisan::call('clear-compiled');
//use flags in artisan call
Artisan::call('migrate:refresh', [
'--force' => true,
]);
}
?>
click for more Laravel codes read about laravel artisan commands