コード例 #1
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'));
     }
 }