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() {
Auth::logout();
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.
routes.php
Route::get('/', function()
{
return View::make('hello');
});
Route::controller('users', 'UsersController');
HTML
@if(!Auth::check())
<li>{{ HTML::link('users/register', 'Register') }}</li>
<li>{{ HTML::link('users/login', 'Login') }}</li>
@else
<li>{{ HTML::link('users/logout', 'logout') }}</li>
@endif
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.
see: http://laravel.com/docs/upgrade#upgrade-4.1.26
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.
$table->rememberToken();
Laravel Docs - Schema - Adding Columns
If you have Laravel 4.2 you can do this:
Command Line:
php artisan migrate:make add_remember_token_to_users_table --table="users"
After this open the file app/database/migrations/2014_10_16_124421_add_remember_token_to_users_table and edit it like this:
public function up()
{
Schema::table('users', function(Blueprint $table)
{
$table->rememberToken();
});
}
public function down()
{
Schema::table('users', function(Blueprint $table)
{
$table->dropColumn('remember_token');
});
}
for your problem ,you may pass null value or you may off your remember_token value in your model php file as
public $remember_token=false;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With