Add /acars/event as alias to /acars/log, and accept event as log line
This commit is contained in:
parent
8c3b271294
commit
e57f0cb234
@ -263,6 +263,10 @@ class PirepController extends RestController
|
|||||||
$log['pirep_id'] = $id;
|
$log['pirep_id'] = $id;
|
||||||
$log['type'] = AcarsType::LOG;
|
$log['type'] = AcarsType::LOG;
|
||||||
|
|
||||||
|
if(array_has($log, 'event')) {
|
||||||
|
$log['log'] = $log['event'];
|
||||||
|
}
|
||||||
|
|
||||||
$acars = Acars::create($log);
|
$acars = Acars::create($log);
|
||||||
$acars->save();
|
$acars->save();
|
||||||
++$count;
|
++$count;
|
||||||
|
@ -23,6 +23,7 @@ class LogRequest extends FormRequest
|
|||||||
$rules = [
|
$rules = [
|
||||||
'logs' => 'required|array',
|
'logs' => 'required|array',
|
||||||
'logs.*.log' => 'required',
|
'logs.*.log' => 'required',
|
||||||
|
'logs.*.event' => 'nullable',
|
||||||
'logs.*.lat' => 'nullable|numeric',
|
'logs.*.lat' => 'nullable|numeric',
|
||||||
'logs.*.lon' => 'nullable|numeric',
|
'logs.*.lon' => 'nullable|numeric',
|
||||||
'logs.*.created_at' => 'nullable|date',
|
'logs.*.created_at' => 'nullable|date',
|
||||||
|
@ -44,6 +44,7 @@ Route::group(['middleware' => ['api.auth']], function ()
|
|||||||
Route::post('pireps/{pirep_id}/acars/position', 'PirepController@acars_store');
|
Route::post('pireps/{pirep_id}/acars/position', 'PirepController@acars_store');
|
||||||
Route::post('pireps/{pirep_id}/acars/positions', 'PirepController@acars_store');
|
Route::post('pireps/{pirep_id}/acars/positions', 'PirepController@acars_store');
|
||||||
|
|
||||||
|
Route::post('pireps/{pirep_id}/acars/event', 'PirepController@acars_log');
|
||||||
Route::post('pireps/{pirep_id}/acars/log', 'PirepController@acars_log');
|
Route::post('pireps/{pirep_id}/acars/log', 'PirepController@acars_log');
|
||||||
Route::post('pireps/{pirep_id}/acars/logs', 'PirepController@acars_log');
|
Route::post('pireps/{pirep_id}/acars/logs', 'PirepController@acars_log');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user