Last active
July 16, 2025 23:22
-
-
Save mrunknown0001/0e7ccf39aa40dec9eb6a059a24e2cc79 to your computer and use it in GitHub Desktop.
Custom Console for Automated Optimization of Laravel Application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Console\Commands; | |
| use Illuminate\Console\Command; | |
| use Illuminate\Support\Facades\Cache; | |
| class ClearOptimize extends Command | |
| { | |
| /** | |
| * The name and signature of the console command. | |
| * | |
| * @var string | |
| */ | |
| protected $signature = 'clear:optimize'; | |
| /** | |
| * The console command description. | |
| * | |
| * @var string | |
| */ | |
| protected $description = 'Optimize, clear cache, and cache views and routes'; | |
| /** | |
| * Execute the console command. | |
| * | |
| * @return int | |
| */ | |
| public function handle() | |
| { | |
| Command::call('optimize:clear'); | |
| Command::call('view:cache'); | |
| Command::call('route:cache'); | |
| $this->info("Application is optimized, and views and routes are cached!"); | |
| return 0; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment