2017-11-30 08:01:07 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
class CreateUserRequest extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2017-11-30 08:01:07 +08:00
|
|
|
* @return array
|
|
|
|
*/
|
2018-03-22 01:35:06 +08:00
|
|
|
public function rules(): array
|
2017-11-30 08:01:07 +08:00
|
|
|
{
|
2020-02-24 06:21:26 +08:00
|
|
|
$rules = [
|
|
|
|
'name' => 'required',
|
|
|
|
'email' => 'required|email|unique:users,email',
|
|
|
|
'airline_id' => 'required',
|
|
|
|
'home_airport_id' => 'required',
|
|
|
|
'password' => 'required|confirmed',
|
|
|
|
'timezone' => 'required',
|
|
|
|
'country' => 'required',
|
|
|
|
'transfer_time' => 'sometimes|integer|min:0',
|
|
|
|
'toc_accepted' => 'accepted',
|
|
|
|
];
|
2019-07-17 23:00:30 +08:00
|
|
|
|
2020-02-24 06:21:26 +08:00
|
|
|
if (config('captcha.enabled')) {
|
|
|
|
$rules['g-recaptcha-response'] = 'required|captcha';
|
|
|
|
}
|
2019-07-17 23:00:30 +08:00
|
|
|
|
2018-01-03 13:20:36 +08:00
|
|
|
return $rules;
|
2017-11-30 08:01:07 +08:00
|
|
|
}
|
|
|
|
}
|