2020-04-12 00:26:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Initialize;
|
|
|
|
|
|
|
|
class InitializeNationalities {
|
|
|
|
|
|
|
|
private $bar;
|
|
|
|
private $api;
|
|
|
|
|
|
|
|
public function __construct($bar, $api) {
|
|
|
|
$this->bar = $bar;
|
|
|
|
$this->api = $api;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handle() {
|
|
|
|
$this->bar->task('Synchronisiere Nationalitäten', function() {
|
2021-04-10 00:29:48 +02:00
|
|
|
$this->api->nationalities()->each(function($nationality) {
|
|
|
|
\App\Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->name]);
|
2020-04-12 00:26:44 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|