classes/Exceptions/Handler.php
protected function handle404s($request, BaseException $e)
    {
        // Check for right exception
        if (!is_a($e, ModelNotFoundException::class) && !is_a($e, NotFoundHttpException::class)) {
            return;
        }

        // Check for a valid redirect
        if ($rule = RedirectRule::matchUsingRequest()->first()) {
            return redirect($rule->to, $rule->code);
        }

        // Return header only on AJAX
        if ($request->ajax()) {
            return response(null, 404);
        }
    }
protected function handle404s($request, BaseException $e)
    {
        // Check for right exception
        if (!is_a($e, ModelNotFoundException::class) && !is_a($e, NotFoundHttpException::class)) {
            return;
        }

        // Check for a valid redirect
        if ($rule = RedirectRule::matchUsingRequest()->first()) {
            return redirect($rule->to, $rule->code);
        }

        // Return header only on AJAX
        if ($request->ajax()) {
            return response(null, 404);
        }
    }
protected function handle404s ( $ request , BaseException $ e ) { // Check for right exception if ( ! is_a ( $ e , ModelNotFoundException :: class ) && ! is_a ( $ e , NotFoundHttpException :: class ) ) { return ; } // Check for a valid redirect if ( $ rule = RedirectRule :: matchUsingRequest ( ) -> first ( ) ) { return redirect ( $ rule -> to , $ rule -> code ) ; } // Return header only on AJAX if ( $ request -> ajax ( ) ) { return response ( null , 404 ) ; } }
If a 404 exception, check if there is a redirect rule.  Or return a simple
header if an AJAX request.

@param  \Illuminate\Http\Request          $request
@param  \Exception                        $e
@return \Illuminate\Http\RedirectResponse
If a 404 exception check if there is a redirect rule . Or return a simple header if an AJAX request .