redirect bad routes to search page
This commit is contained in:
parent
250d7a6d37
commit
9d700a1fb0
@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
|
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
@ -49,6 +50,9 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
public function render($request, Throwable $exception)
|
public function render($request, Throwable $exception)
|
||||||
{
|
{
|
||||||
|
if ($exception instanceof NotFoundHttpException) {
|
||||||
|
return redirect('/search');
|
||||||
|
}
|
||||||
return parent::render($request, $exception);
|
return parent::render($request, $exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user