Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Requests;
- use App\User;
- use Illuminate\Validation\Rule;
- use Illuminate\Foundation\Http\FormRequest;
- class UserRequest extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- *
- * @return bool
- */
- public function authorize()
- {
- return auth()->check();
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array
- */
- public function rules()
- {
- return [
- 'name' => [
- 'required', 'min:3'
- ],
- 'username' => [
- 'required', 'min:6'
- ],
- 'password' => [
- $this->route()->user ? 'nullable' : 'required', 'confirmed', 'min:6'
- ],
- 'user_rights' => [
- 'required', 'min:3'
- ]
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement