osb/database/seeds/CountryTableSeeder.php

27 lines
443 B
PHP
Raw Normal View History

<?php
use Illuminate\Database\Seeder;
2018-06-18 11:51:20 +00:00
use App\Models\{Country,Currency};
class CountryTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
2018-06-18 11:51:20 +00:00
public function run()
{
$o = new Country;
2018-07-06 06:57:49 +00:00
$o->id = 61;
2018-06-18 11:51:20 +00:00
$o->name = 'Australia';
$o->two_code = 'AU';
$o->three_code = 'AUS';
$o->active = TRUE;
2018-06-18 11:51:20 +00:00
$oo = Currency::where('iso_code','AUD')->firstOrFail();
2018-06-18 11:51:20 +00:00
$oo->countries()->save($o);
}
}