Files
admin-php-module-core/app/Console/Kernel.php

37 lines
864 B
PHP

<?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 = CORE_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);
}
}