adrema/app/Initialize/InitializeRegions.php

20 lines
435 B
PHP
Raw Normal View History

2020-04-12 00:26:44 +02:00
<?php
namespace App\Initialize;
class InitializeRegions {
private $api;
2021-04-10 00:55:43 +02:00
private $nullName = 'Nicht-DE';
2020-04-12 00:26:44 +02:00
2022-01-03 01:17:24 +01:00
public function __construct($api) {
2020-04-12 00:26:44 +02:00
$this->api = $api;
}
public function handle() {
2022-01-03 01:17:24 +01:00
$this->api->regions()->each(function($region) {
\App\Region::create(['nami_id' => $region->id, 'name' => $region->name, 'is_null' => $region->name == $this->nullName]);
2020-04-12 00:26:44 +02:00
});
}
}