Do a comparison for Laravel 5.5 when auto-discovering commands

This commit is contained in:
Andy Heathershaw 2019-07-28 12:51:12 +01:00
parent c8952a8ac1
commit 728d14563e

View File

@ -6,6 +6,7 @@ use App\Console\Commands\ProcessUploadCommand;
use App\Console\Commands\RegenerateThumbnailsCommand; use App\Console\Commands\RegenerateThumbnailsCommand;
use App\Upload; use App\Upload;
use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel class Kernel extends ConsoleKernel
@ -36,6 +37,11 @@ class Kernel extends ConsoleKernel
protected function commands() protected function commands()
{ {
require base_path('routes/console.php'); require base_path('routes/console.php');
// We can only auto-load commands for Laravel 5.5.0 or above
if (version_compare(Application::VERSION, '5.5.0') >= 0)
{
$this->load(__DIR__.'/Commands'); $this->load(__DIR__.'/Commands');
} }
}
} }