コード例 #1
0
 public function run()
 {
     DB::table('insunits')->delete();
     $collection = [['unit' => 'EU'], ['unit' => 'BU'], ['unit' => 'OU']];
     foreach ($collection as $record) {
         Insunit::create($record);
     }
 }
コード例 #2
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Insunit::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }