phpvms/app/Http/Requests/CreateUserRequest.php

46 lines
1.1 KiB
PHP
Raw Normal View History

2017-11-30 08:01:07 +08:00
<?php
namespace App\Http\Requests;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
class CreateUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
2018-08-27 00:40:04 +08:00
*
2017-11-30 08:01:07 +08:00
* @return bool
*/
2018-03-22 01:35:06 +08:00
public function authorize(): bool
2017-11-30 08:01:07 +08:00
{
return true;
}
/**
* 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
{
$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
if (config('captcha.enabled')) {
$rules['g-recaptcha-response'] = 'required|captcha';
}
2019-07-17 23:00:30 +08:00
return $rules;
2017-11-30 08:01:07 +08:00
}
}