2020-04-12 00:26:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Initialize;
|
|
|
|
|
|
|
|
use App\Member;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
use Aweos\Agnoster\Progress\HasProgress;
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
2021-06-21 23:50:09 +02:00
|
|
|
use Zoomyboy\LaravelNami\NamiUser;
|
2020-04-12 00:26:44 +02:00
|
|
|
|
|
|
|
class InitializeJob implements ShouldQueue
|
|
|
|
{
|
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, HasProgress;
|
|
|
|
|
|
|
|
public $user;
|
|
|
|
|
|
|
|
public static $initializers = [
|
|
|
|
InitializeNationalities::class,
|
|
|
|
InitializeFees::class,
|
|
|
|
InitializeConfessions::class,
|
|
|
|
InitializeCountries::class,
|
|
|
|
InitializeGenders::class,
|
|
|
|
InitializeRegions::class,
|
|
|
|
InitializeActivities::class,
|
2020-06-01 22:22:19 +02:00
|
|
|
InitializeMembers::class,
|
2020-04-12 00:26:44 +02:00
|
|
|
];
|
|
|
|
|
2021-06-21 23:50:09 +02:00
|
|
|
public function __construct(NamiUser $user)
|
2020-04-12 00:26:44 +02:00
|
|
|
{
|
|
|
|
$this->user = $user;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the job.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2021-06-21 23:50:09 +02:00
|
|
|
$api = $this->user->api();
|
2020-04-12 00:26:44 +02:00
|
|
|
$bar = $this->createProgressBar('Initialisiere');
|
|
|
|
|
|
|
|
foreach (static::$initializers as $initializer) {
|
|
|
|
(new $initializer($bar, $api))->handle();
|
|
|
|
}
|
|
|
|
|
|
|
|
$bar->finish('Initialisierung abgeschlossen');
|
|
|
|
}
|
|
|
|
}
|