adrema/app/Initialize/InitializeNationalities.php

19 lines
380 B
PHP
Raw Normal View History

2020-04-12 00:26:44 +02:00
<?php
namespace App\Initialize;
class InitializeNationalities {
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->nationalities()->each(function($nationality) {
\App\Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->name]);
2020-04-12 00:26:44 +02:00
});
}
}