Exemplo n.º 1
0
 public function run()
 {
     if (Country::all()->count() > 0) {
         return;
     }
     Country::create(array('name' => 'Malaysia'));
     Country::create(array('name' => 'Singapore'));
     Country::create(array('name' => 'Brunei'));
 }
Exemplo n.º 2
0
 public function run()
 {
     foreach ($this->getMalaysiaStates() as $state) {
         $stateIsExist = State::where('name', $state)->count();
         if (!$stateIsExist) {
             State::create(array('country_id' => Country::Malaysia()->id, 'name' => $state));
         }
     }
     $isBruneiExist = State::where('name', 'Brunei')->count();
     if (!$isBruneiExist) {
         State::create(array('country_id' => Country::Brunei()->id, 'name' => 'Brunei'));
     }
     $isSingaporeExist = State::where('name', 'Singapore')->count();
     if (!$isSingaporeExist) {
         State::create(array('country_id' => Country::Singapore()->id, 'name' => 'Singapore'));
     }
 }