コード例 #1
0
 public function SaveToDatabase($data)
 {
     //delete from database old, write to database new
     DB::transaction(function () use($data) {
         $flight = Flight::firstOrNew(['hour_stamp_flight_number' => $data['hour_stamp_flight_number']]);
         foreach ($data as $column => $value) {
             $flight->{$column} = $value;
         }
         $flight->save();
     });
 }