sanainfotech
sanainfotech

Reputation: 691

Auth::logout in laravel 5.2 is not working

My question is very similar asked here

I am using Laravel 5.2

My route:list

Route list

My logout link

<a href="logout" class="btn1 btn-1 btn1-1b">Logout</a>

The logout link is in header.blade.php file. The location of the file is

Views->profile->header.blade.php

My route.php

Route::get('profile/logout', 'Auth\AuthController@getLogout');

This Route is out side of middleware

AuthController.php

public function __construct()
{
     $this->middleware('guest', ['except' => ['logout', 'getLogout']]);
}

When Logout button clicked its redirect as per requirement by session is not ending, as I am still logged in if I visit through URL

Upvotes: 1

Views: 531

Answers (2)

sanainfotech
sanainfotech

Reputation: 691

Thanks for all your answers, I figured it out by organizing layout using laravel blade.

Before I had subfolder under my views,

So I managed to pull out all subfolder align them just under views as below,

-- views

--- layouts

------- default.blade.php

------- sidebar.blade.php

--- profile

------- home.blade.php

------- about.blade.php

------- projects.blade.php

------- contact.blade.php

------- create.blade.php

--- includes

------- head.blade.php

------- header.blade.php

------- footer.blade.php

------- sidebar.blade.php

Upvotes: 0

borovaka
borovaka

Reputation: 1

Since Laravel 5.2, you should add web middleware to use session. Try to add web middleware in constructor or in route.

Upvotes: 0

Related Questions