Split out the saveRoute() fn so it's only during a manual filing, not ACARS
This commit is contained in:
@@ -290,9 +290,10 @@ class PirepController extends RestController
|
|||||||
Log::info('Posting ACARS log', $request->toArray());
|
Log::info('Posting ACARS log', $request->toArray());
|
||||||
|
|
||||||
$attrs = $this->getFromReq($request, [
|
$attrs = $this->getFromReq($request, [
|
||||||
'log' => 'required',
|
'log' => 'required',
|
||||||
'lat' => 'nullable',
|
'lat' => 'nullable',
|
||||||
'lon' => 'nullable',
|
'lon' => 'nullable',
|
||||||
|
'created_at' => 'nullable',
|
||||||
], ['pirep_id' => $id, 'type' => AcarsType::LOG]);
|
], ['pirep_id' => $id, 'type' => AcarsType::LOG]);
|
||||||
|
|
||||||
$acars = Acars::create($attrs);
|
$acars = Acars::create($attrs);
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ class PirepController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pirep = $this->pirepSvc->create($pirep, $custom_fields);
|
$pirep = $this->pirepSvc->create($pirep, $custom_fields);
|
||||||
|
$this->pirepSvc->saveRoute($pirep);
|
||||||
|
|
||||||
//Flash::success('PIREP submitted successfully!');
|
//Flash::success('PIREP submitted successfully!');
|
||||||
return redirect(route('frontend.pireps.index'));
|
return redirect(route('frontend.pireps.index'));
|
||||||
|
|||||||
@@ -168,9 +168,6 @@ class PIREPService extends BaseService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Save the PIREP route
|
|
||||||
$pirep = $this->saveRoute($pirep);
|
|
||||||
|
|
||||||
$pirep->save();
|
$pirep->save();
|
||||||
$pirep->refresh();
|
$pirep->refresh();
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class PIREPTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$pirep = $this->pirepSvc->create($pirep, []);
|
$pirep = $this->pirepSvc->create($pirep, []);
|
||||||
|
$this->pirepSvc->saveRoute($pirep);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the initial state info
|
* Check the initial state info
|
||||||
|
|||||||
Reference in New Issue
Block a user