Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <form method="POST" action="some_url">
  2. <input name="_method" type="hidden" value="PATCH">
  3. <input type="hidden" name="_token" value="{{ csrf_token() }}">
  4. <input name="job_title" type="text" value="{{isset($profile->job_title) ? $profile->job_title : old('job_title') }}" class="form-control">
  5. <button type="submit">Submit</button>
  6. </form>
  7.  
  8. class ProfileRequest extends FormRequest {
  9.  
  10.  
  11. public function authorize()
  12. {
  13. return true;
  14. }
  15.  
  16.  
  17. public function rules()
  18. {
  19. return = [
  20. 'job_title' => 'required|max:100',
  21. ];
  22. }
  23.  
  24.  
  25. protected function failedValidation(Validator $validator)
  26. {
  27.  
  28. throw (new ValidationException($validator))
  29. ->errorBag($this->errorBag)
  30. ->redirectTo($this->getRedirectUrl());
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement