Auto-discovers all dashboard permissions from resource/prefix matrix, creates missing ones in DB, syncs to super_admin and admin roles. Run on production after deploy or when adding new menu sections.
52 lines
1.4 KiB
PHP
Executable File
52 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Ship\Kernels;
|
|
|
|
use AlxDorosenco\PortoForLaravel\Loaders\CommandsLoader;
|
|
use AlxDorosenco\PortoForLaravel\Loaders\RoutesLoader;
|
|
use App\Containers\Dashboard\Commands\FetchEmailNewsCommand;
|
|
use App\Ship\Commands\InitRoles;
|
|
use App\Ship\Commands\SyncDashboardPermissions;
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use Illuminate\Foundation\Console\Kernel as LaravelConsoleKernel;
|
|
|
|
class ConsoleKernel extends LaravelConsoleKernel
|
|
{
|
|
use CommandsLoader;
|
|
use RoutesLoader;
|
|
|
|
/**
|
|
* Define the application's command schedule.
|
|
*
|
|
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
|
* @return void
|
|
*/
|
|
protected function schedule(Schedule $schedule)
|
|
{
|
|
$schedule->command('sitemap:generate')->dailyAt('03:00');
|
|
|
|
// Получение новостей из Email каждые 5 минут
|
|
$schedule->command(FetchEmailNewsCommand::class)
|
|
->everyFiveMinutes()
|
|
->withoutOverlapping()
|
|
->onOneServer();
|
|
}
|
|
|
|
protected $commands = [
|
|
InitRoles::class,
|
|
FetchEmailNewsCommand::class,
|
|
SyncDashboardPermissions::class,
|
|
];
|
|
|
|
/**
|
|
* Register the commands for the application.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function commands()
|
|
{
|
|
$this->loadCommandsForConsoleKernel();
|
|
$this->loadRoutesForConsoleKernel();
|
|
}
|
|
}
|