Upsert on ACARS positions #572 (#573)

This commit is contained in:
Nabeel S
2020-02-22 16:03:01 -05:00
committed by GitHub
parent 6e87f7804c
commit 9ed07da9c3
6 changed files with 91 additions and 28 deletions

View File

@@ -542,8 +542,12 @@ class PirepController extends Controller
$position['pirep_id'] = $id;
$position['type'] = AcarsType::ROUTE;
$acars = Acars::create($position);
$acars->save();
if (isset($position['id'])) {
Acars::updateOrInsert(['id' => $position['id']], $position);
} else {
$acars = Acars::create($position);
$acars->save();
}
$count++;
}