osb/database/seeders/CountryTableSeeder.php

29 lines
472 B
PHP
Raw Permalink Normal View History

<?php
2021-06-30 01:06:20 +00:00
namespace Database\Seeders;
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);
}
}