Laravel redirect with logout not working

前端 未结 7 1235
夕颜
夕颜 2021-01-30 09:41

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 somethi

相关标签:
7条回答
  • 2021-01-30 09:47

    Due to the current Laravel update there should be a "remember_token" column in the user table. This solves the problem.

    0 讨论(0)
  • 2021-01-30 09:48

    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

    0 讨论(0)
  • 2021-01-30 09:51

    You need to add updated_at column into your SQL table user_tbl. If you do not wish to use it. you may also turn off timestamps within your model.

    0 讨论(0)
  • 2021-01-30 09:59

    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;
    
    0 讨论(0)
  • 2021-01-30 10:01

    I learned that I was getting the logout error in my application because I was using

    Route::post('logout', array('uses' => 'SessionController@doLogout'));
    

    Just remember to use the following instead.

    Route::get('logout', array('uses' => 'SessionController@doLogout'));
    

    This worked smoothly.

    0 讨论(0)
  • 2021-01-30 10:14

    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');
        });
    }
    
    0 讨论(0)
提交回复
热议问题