K
K
KeyDel2016-10-24 12:29:47
Laravel
KeyDel, 2016-10-24 12:29:47

Laravel 5.3 - Throws an AuthenticationException after installing the graham-campbell (Laravel Exceptions) package. How to setup?

Laravel 5.3 - after installing the graham-campbell package (Laravel Exceptions), it throws an AuthenticationException (it is expected that, as with the standard handler, it should redirect to the login page).
Tried to dig into the ..\graham-campbell\exceptions\config\exceptions.php file, but found no visible reaction.
How can you set up?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aak74, 2017-04-18
@aak74

in the app\Exceptions\Handler.php file, replace the render function with the following:

public function render($request, Exception $exception)
{
    /**
     * in GrahamCampbell\Exceptions doesn't invoke method 'unauthenticated'
     * so we need to invoke this method by self
     */
    if (get_class($exception) == 'Illuminate\Auth\AuthenticationException') {
        return $this->unauthenticated($request, $exception);
    }
    return parent::render($request, $exception);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question