Version 1.0
This commit is contained in:
36
app/Console/Kernel.php
Normal file
36
app/Console/Kernel.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Commands\HelloWorld;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
|
||||
use App\Helpers\ClassHelper;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function getCommands()
|
||||
{
|
||||
$commands_path = base_path() . '/../commands';
|
||||
$files = array_diff(scandir($commands_path), array('.', '..'));
|
||||
|
||||
$classes = [];
|
||||
foreach($files as $file) {
|
||||
$classes[] = ClassHelper::extract($commands_path . '/' . $file);
|
||||
}
|
||||
|
||||
$commands = parent::getCommands();
|
||||
return array_merge($commands, $classes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user