2018-01-29 01:12:13 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Acars;
|
|
|
|
|
2018-05-10 01:45:24 +08:00
|
|
|
use App\Interfaces\FormRequest;
|
2018-01-29 01:12:13 +08:00
|
|
|
use App\Models\Pirep;
|
|
|
|
use Auth;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class RouteRequest
|
|
|
|
* @package App\Http\Requests\Acars
|
|
|
|
*/
|
|
|
|
class RouteRequest extends FormRequest
|
|
|
|
{
|
|
|
|
public function authorize()
|
|
|
|
{
|
|
|
|
$pirep = Pirep::findOrFail($this->route('pirep_id'), ['user_id']);
|
|
|
|
return $pirep->user_id === Auth::id();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
$rules = [
|
2018-08-05 00:47:56 +08:00
|
|
|
'route' => 'nullable|array',
|
|
|
|
/*'route.*.name' => 'required',
|
2018-03-20 09:50:40 +08:00
|
|
|
'route.*.order' => 'required|int',
|
2018-01-29 01:12:13 +08:00
|
|
|
'route.*.nav_type' => 'nullable|int',
|
2018-03-20 09:50:40 +08:00
|
|
|
'route.*.lat' => 'required|numeric',
|
2018-08-05 00:47:56 +08:00
|
|
|
'route.*.lon' => 'required|numeric',*/
|
2018-01-29 01:12:13 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
return $rules;
|
|
|
|
}
|
|
|
|
}
|