richa
richa

Reputation: 131

Maintain sessions in Laravel 4

I don't know how to maintain and work with sessions. As I am a newbie in Laravel 4.

I have created a table as follows:

class Sessions extends Migration 
{
Schema::create('sessions', function($table)
{
    $table->string('id')->unique();
    $table->text('payload');
    $table->integer('last_activity');
});
}

Is this correct?

Upvotes: 1

Views: 1392

Answers (1)

Abishek
Abishek

Reputation: 11711

Step 1: php artisan session:table

Step 2: composer dump-autoload

Step 3: php artisan migrate

if you have setup multiple environment on your laravel app then

php artisan migrate --env=ENVIRONMENT_NAME

Step 4: Change the default driver on /app/config/session.php to

'driver'=>'database',

if you have multiple Databases configured on your L4 app, then configure the connection on /app/config/session.php

'connection'=>CONNECTION_NAME

Upvotes: 5

Related Questions