Files
portal/database/seeders/CountriesTableSeeder.php
T

41 lines
875 B
PHP

<?php
namespace Database\Seeders;
use App\Classes\Modules\Countries\DataTransferObjects\CountryObject;
use App\Classes\Modules\Countries\Services\CreatesCountry;
use Illuminate\Database\Seeder;
class CountriesTableSeeder extends Seeder
{
/** @var CreatesCountry */
private $createsCountry;
/**
* CountriesTableSeeder constructor.
* @param CreatesCountry $createsCountry
*/
public function __construct(CreatesCountry $createsCountry)
{
$this->createsCountry = $createsCountry;
}
/**
* Run the database seeds.
*
* @return void
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function run()
{
foreach (['my', 'cn'] as $code) {
$object = new CountryObject(country($code));
$this->createsCountry->execute($object);
}
}
}