Add /acars/event as alias to /acars/log, and accept event as log line

This commit is contained in:
Nabeel Shahzad 2018-01-28 12:02:41 -06:00
parent 8c3b271294
commit e57f0cb234
3 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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',

View File

@ -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');