added read-only
mode #28nd2px
This commit is contained in:
30
app/Listeners/Common/SkipScheduleInReadOnlyMode.php
Normal file
30
app/Listeners/Common/SkipScheduleInReadOnlyMode.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user