xxxxxxxxxx
public function render($request, Throwable $exception)
{
if ($exception instanceof \Illuminate\Http\Exceptions\PostTooLargeException) {
return $this->showCustomErrorPage();
}
return parent::render($request, $exception);
}
protected function showCustomErrorPage()
{
return \Illuminate\Support\Facades\Redirect::back()->withErrors(['max_upload' => 'The Message']);
}
xxxxxxxxxx
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
xxxxxxxxxx
@error('max_upload')
<div class="alert" id="create-news-alert-image">{{ $message }}</div>
@enderror