1

I tried so many ways still not able to solve this issue.

View Code

<!DOCTYPE html>
<html>
    <body>
        {!! HTML::link('auth/logout', 'Logout') !!}
    </body>
</html>

In \app\Http\Controllers\Auth\AuthController.php

public function getLogout()
    { 

        $this->auth->logout(); // OR
        // Auth::logout();
        Session::flush();
        return redirect('/auth/login');
    }

I tried both ways still it show error

Undefined property: App\Http\Controllers\Auth\AuthController::$auth

Any idea how to solve this?

3
  • What error are you getting when calling Auth::logout()? For sure not the "Undefined property" Commented Jul 12, 2015 at 11:27
  • For Auth::logout() getting this error "Class 'App\Http\Controllers\Auth\Auth' not found" Commented Jul 12, 2015 at 11:33
  • I posted an answer on how to fix that. Commented Jul 12, 2015 at 11:34

1 Answer 1

2

Auth::logout() will work, just add

use Auth;

at the top of your controller file.

Sign up to request clarification or add additional context in comments.

2 Comments

Able to logout. For Session::flush(); it gives Class 'App\Http\Controllers\Auth\Session' not found
If you do not provide a "use" statement then the class is being loaded from current namespace (App\Http\Controllers\Auth)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.