mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
fixed maintenance
This commit is contained in:
parent
765f7017ca
commit
59acc04831
21
app/Listeners/RunForSavedForm.php
Executable file
21
app/Listeners/RunForSavedForm.php
Executable file
@ -0,0 +1,21 @@
|
||||
<?php namespace App\Listeners;
|
||||
|
||||
use Anomaly\SettingsModule\Setting\Form\SettingFormRepository;
|
||||
use Anomaly\Streams\Platform\Ui\Form\Event\FormWasSaved;
|
||||
|
||||
class RunForSavedForm
|
||||
{
|
||||
|
||||
public function handle(FormWasSaved $event)
|
||||
{
|
||||
$builder = $event->getBuilder();
|
||||
|
||||
if (get_class($builder->getRepository()) === SettingFormRepository::class) {
|
||||
if ($builder->getFormValues()->has('maintenance') and $builder->getFormValues()->get('maintenance')) {
|
||||
file_put_contents(storage_path('framework/down'),
|
||||
json_encode(['time' => '', 'retry' => null, 'message' => null],
|
||||
JSON_PRETTY_PRINT));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,9 @@ return [
|
||||
\Anomaly\Streams\Platform\Event\Booted::class => [
|
||||
\App\Listeners\Translations::class
|
||||
],
|
||||
\Anomaly\Streams\Platform\Ui\Form\Event\FormWasSaved::class => [
|
||||
\App\Listeners\RunForSavedForm::class
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user