Uygulamayı localde daha hızlı çalıştırmak ve web'e göndermeden önce (ftp ile yüklenecekse) son rotüşünü yapmak için böyle bir konsol komutu kullanıyorum.
Bunu başka bir konsol komutu içinden de çalıştırıyorum ama bağımsız da kullanabilirsiniz:
Bunu başka bir konsol komutu içinden de çalıştırıyorum ama bağımsız da kullanabilirsiniz:
php artisan fasten
<?php
namespace App\Console;
use Illuminate\Console\Command;
class Fasten extends Command
{
protected $signature = 'fasten';
protected $description = 'Fasten application';
public function __construct()
{
parent::__construct();
}
public function handle()
{
if (app()->environment() == 'local') {
$start = microtime(true);
$this->info('Application fastening started.');
$cacheAll = [
'config:cache', 'route:cache',
];
foreach ($cacheAll as $cache) {
$this->call($cache);
}
shell_exec('composer dump-autoload -o');
$message = 'Application successfully fastened in ' . number_format(microtime(true) - $start, 2) . ' seconds.';
logger($message);
$this->info($message);
}
}
}