Sunday, March 19, 2017

Laravel - Method [guest] does not exist on Redirect

Been searching hours for solution online but could not find a solution to this problem:

BadMethodCallException in RedirectResponse.php line 228: Method [guest] does not exist on Redirect.

This is my controller:

class MemberController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index()
    {
        return view('member.home');
    }
}

class SessionController extends Controller
{
    public function __construct()
    {
        $this->middleware('guest', ['except' => 'destroy']);
    }

    public function create()
    {
        return view('session.create');
    }
}

This is my routes/web.php:

Route::get('/member', 'MemberController@index');
Route::get('/login', 'SessionController@create')->name('login');

When I try to access 127.0.0.1/member, the above error pops up.

Any idea?



via Sarah

Advertisement