Я написал код для команды cron, как показано ниже в люменах (микрорамка laravel)
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\EmailDump;
use DB;
/**
* dumpEmails Class
*
* This cron is to dump emails with cron use
*
* @author Hetal Gohel <hetal.gohel@brainvire.com>
*
*/
class dumpEmails extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'insert:emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This cron is to dump emails with cron use';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "1";die;
}
}
в файле ядра, указанном ниже,
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
\Laravelista\LumenVendorPublish\VendorPublishCommand::class,
'\App\Console\Commands\dumpEmails',
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
// protected function schedule(Schedule $schedule)
// {
// return $schedule;
// }
}
Я запустил команду с консоли, как показано ниже,
php artisan insert:emails
во время выполнения этой команды, получая ошибку, как показано ниже,
[Symfony \ Component \ Console \ Exception \ CommandNotFoundException] ← [39; 49 м
← [37; 41m В пространстве имен «insert» не определено ни одной команды.
Пожалуйста, помогите мне решить эту проблему. Спасибо.