Exemple #1
0
 /**
  * заполнение таблицы кошельков
  */
 private function cardsTable()
 {
     Card::truncate();
     $data = [['user_id' => 1, 'title' => 'Visa', 'balance' => ''], ['user_id' => 2, 'title' => 'Master Card', 'balance' => ''], ['user_id' => 3, 'title' => 'Qiwi', 'balance' => '']];
     foreach ($data as $v) {
         Card::create($v);
     }
     // заполнение значений главной карты
     $users = User::all();
     foreach ($users as $u) {
         $u->main_card = Card::where('user_id', $u->id)->first()->id;
         $u->save();
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Card::truncate();
     $data = [['title' => "VT", 'name' => 'Viettel', 'image' => 'images/viettel.jpg'], ['title' => "MOBI", 'name' => 'Mobiphone', 'image' => 'images/mobi.jpg'], ['title' => "VINA", 'name' => 'Vinaphone', 'image' => 'images/vina.jpg'], ['title' => "GATE", 'name' => 'FPT Gate', 'image' => 'images/fpt.jpg']];
     Card::insert($data);
 }