I am working in a Laravel Valet php7.4 environment, on a Laravel 7.4 app. With this, I have created a form request that updates a user's bio, with the following validation:
'bio' => ['nullable', 'max:255']
Whenever I put a huge amount of characters in, my local (Nginx) server seems to collapse and Laravel isn't pooping out the error by validation. I was getting Valet 502 Bad Gateway errors, that I fixed by adding this to the valet config:
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
Now the 502 errors are gone, but it is still not Laravel that is catching the request error. Any ideas why?
Edit: some more information on the request part
Form:
<form
class="form"
method="POST"
action="{{ route('settings.profile.update') }}"
>
{{ csrf_field() }}
{{ method_field('PATCH') }}
<div class="form-group">
<x-input-textarea
label="Bio"
name="bio"
:value="$user->profile->bio"
ref="bio"
/>
</div>
<x-button
class="button--primary"
label="Opslaan"
/>
</form>
The textarea Blade component
<div class="form-field">
@isset( $label )
<label class="label" for="{{ $name }}">{{ $label }}</label>
@endif
<textarea
{{ $attributes->merge(['class' => "input input--textarea"]) }}
name="{{ $name }}"
id="{{ $name }}"
placeholder="{{ $placeholder ?? ($label ?? null) }}"
{{ ($required ?? false) ? 'required' : '' }}
{{ isset($autocomplete) ? 'autocomplete=' . $autocomplete : '' }}
>{{ old($name, $value ?? '') }}</textarea>
@if( $errors->has($name) )
<x-input-message
:message="$errors->first($name)"
/>
@elseif( $hint )
<p class="mt-xxsmall text-meta">
{{ $hint }}
</p>
@endif
</div>
The Controller
public function update(ProfileRequest $request)
{
...// authorization
// job
ProfileUpdateJob::dispatchNow($request, $user);
...// returning stuff
}
The Profile Update Job
public function handle()
{
$input = $this->request->validated();
$this->user->profile()->update($input);
}