Skip to content

Instantly share code, notes, and snippets.

@miyasinarafat
Created July 22, 2019 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miyasinarafat/6d73a4b2f8fe9af22e754e831bbf2a91 to your computer and use it in GitHub Desktop.
Save miyasinarafat/6d73a4b2f8fe9af22e754e831bbf2a91 to your computer and use it in GitHub Desktop.
How to organizing Laravel console commands. Gist from this tweet: https://twitter.com/ascheron/status/1153237533695860737
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$paths = [];
$paths[] = __DIR__.'/Commands';
$paths[] = base_path('app_core/Queue/Console');
$paths[] = base_path('routes/console.php');
$this->load($paths);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment