added read-only mode #28nd2px

This commit is contained in:
Denis Duliçi
2022-04-25 15:04:04 +03:00
parent 938d43c58b
commit 685aadd67c
11 changed files with 192 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Listeners\Common;
use Illuminate\Console\Events\CommandStarting as Event;
use Illuminate\Console\Scheduling\Schedule;
class SkipScheduleInReadOnlyMode
{
/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(Event $event)
{
if (! config('read-only.enabled')) {
return;
}
//$event->task->skip(true);
$schedule = app(Schedule::class);
foreach ($schedule->events() as $task) {
$task->skip(true);
}
}
}