示例#1
0
 public function run()
 {
     DB::table('bundles')->delete();
     $collection = [['name' => 'Small', 'description' => 'Left Wing and Avionics', 'color' => '#3f8dc6', 'cost' => 75000, 'value' => 200000], ['name' => 'Large', 'description' => 'Left Wing, Right Wing and Avionics', 'color' => '#c6783f', 'cost' => 100000, 'value' => 300000], ['name' => 'Super Size', 'description' => 'Left Wing, Right, Avionics and Interior', 'color' => '#783fc6', 'cost' => 150000, 'value' => 1000000]];
     foreach ($collection as $record) {
         Bundle::create($record);
     }
 }
示例#2
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Bundle::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }