2022-01-03 01:17:24 +01:00
|
|
|
<?php
|
2020-04-12 00:26:44 +02:00
|
|
|
|
|
|
|
namespace App\Initialize;
|
|
|
|
|
|
|
|
class InitializeCountries {
|
|
|
|
|
|
|
|
private $api;
|
|
|
|
|
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->countries()->each(function($country) {
|
|
|
|
\App\Country::create(['nami_id' => $country->id, 'name' => $country->name]);
|
2020-04-12 00:26:44 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|