winnyboy5 winnyboy5 - 2 months ago 8x
PHP Question

Laravel redirect with logout not working

I am Using laravel 4 framework's. When I used redirect after the Auth::logout(), the redirection was not working. I used View::make() too, but same "Whoops, looks like something went wrong." error throws up.

public function getLogout() {
return Redirect::to('users/login')->with('message', 'Your are now logged out!');

This is the logout code. I am using. Some one please help me with this.


Route::get('/', function()
return View::make('hello');

Route::controller('users', 'UsersController');


<li>{{ HTML::link('users/register', 'Register') }}</li>
<li>{{ HTML::link('users/login', 'Login') }}</li>
<li>{{ HTML::link('users/logout', 'logout') }}</li>

This is what my debugger shows.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'remember_token' in 'field list' (SQL: update `users` set `updated_at` = 2014-04-23 11:30:41, `remember_token` = jSMcfpPnCPrKgwqfhB2tEEEd8h8x6d72viz67MbVzBD27A2G7AH8yWQo1ORf where `id` = 1)


You may be missing the remember_token for the users table.


Laravel requires "nullable remember_token of VARCHAR(100), TEXT, or equivalent to your users table."

Update for new documentation

Laravel 4.2 and up now has a method you can use with your schema builder to add this column.


Laravel Docs - Schema - Adding Columns