session expires then automatic logout user in laravel code example

Example 1: auto logout when session expires laravel

class Kernel extends HttpKernel
{
  // ...
  protected $middlewareGroups = [
    'web' => [
      // ...
      \App\Http\Middleware\SessionTimeout::class,
  ],
}

Example 2: auto logout when session expires laravel

class AddLastSeenToUsersTable extends Migration
{
  public function up()
  {
    Schema::table('users', function (Blueprint $table) {
      $table->timestamp('last_seen_at')->nullable();
    });
  }
 
  public function down()
  {
    Schema::table('users', function (Blueprint $table) {
      $table->dropColumn('last_seen_at');
    });
  }
}

Tags:

Misc Example