Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" action="some_url">
- <input name="_method" type="hidden" value="PATCH">
- <input type="hidden" name="_token" value="{{ csrf_token() }}">
- <input name="job_title" type="text" value="{{isset($profile->job_title) ? $profile->job_title : old('job_title') }}" class="form-control">
- <button type="submit">Submit</button>
- </form>
- class ProfileRequest extends FormRequest {
- public function authorize()
- {
- return true;
- }
- public function rules()
- {
- return = [
- 'job_title' => 'required|max:100',
- ];
- }
- protected function failedValidation(Validator $validator)
- {
- throw (new ValidationException($validator))
- ->errorBag($this->errorBag)
- ->redirectTo($this->getRedirectUrl());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement