adrema/app/Initialize/InitializeJob.php

39 lines
722 B
PHP
Raw Normal View History

2020-04-12 00:26:44 +02:00
<?php
namespace App\Initialize;
2021-11-17 22:32:52 +01:00
use Illuminate\Bus\Queueable;
2020-04-12 00:26:44 +02:00
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
2021-11-17 22:32:52 +01:00
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
2022-11-10 00:13:59 +01:00
use Throwable;
2020-04-12 00:26:44 +02:00
class InitializeJob implements ShouldQueue
{
2022-03-11 20:19:17 +01:00
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
2020-04-12 00:26:44 +02:00
2022-11-16 01:44:19 +01:00
public function __construct()
{
$this->onQueue('long');
}
2020-04-12 00:26:44 +02:00
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
2022-02-19 18:06:07 +01:00
app(Initializer::class)->run();
2020-04-12 00:26:44 +02:00
}
2022-09-02 00:45:39 +02:00
2022-11-10 00:13:59 +01:00
public function failed(Throwable $e): void
2022-09-02 00:45:39 +02:00
{
app(Initializer::class)->restore();
}
2020-04-12 00:26:44 +02:00
}