Advertisement
L1nds3y

Untitled

Feb 19th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Requests;
  4.  
  5. use App\User;
  6. use Illuminate\Validation\Rule;
  7. use Illuminate\Foundation\Http\FormRequest;
  8.  
  9. class UserRequest extends FormRequest
  10. {
  11. /**
  12. * Determine if the user is authorized to make this request.
  13. *
  14. * @return bool
  15. */
  16. public function authorize()
  17. {
  18. return auth()->check();
  19. }
  20.  
  21. /**
  22. * Get the validation rules that apply to the request.
  23. *
  24. * @return array
  25. */
  26. public function rules()
  27. {
  28. return [
  29. 'name' => [
  30. 'required', 'min:3'
  31. ],
  32. 'username' => [
  33. 'required', 'min:6'
  34. ],
  35. 'password' => [
  36. $this->route()->user ? 'nullable' : 'required', 'confirmed', 'min:6'
  37. ],
  38. 'user_rights' => [
  39. 'required', 'min:3'
  40. ]
  41. ];
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement