From 5a50302792a76abf9d8c233f7a2a6f65eaed5bfb Mon Sep 17 00:00:00 2001 From: vickzkater Date: Thu, 9 Jul 2020 10:05:34 +0700 Subject: [PATCH] Update documentation --- README.md | 21 ++++++++++- VERSION.md | 21 +---------- ...020_07_08_211522_create_sessions_table.php | 35 ------------------- 3 files changed, 21 insertions(+), 56 deletions(-) delete mode 100644 database/migrations/2020_07_08_211522_create_sessions_table.php diff --git a/README.md b/README.md index 14e19eb..55e233c 100644 --- a/README.md +++ b/README.md @@ -234,7 +234,26 @@ chmod o+w -R public/uploads/ ## Session Driver Database -If you choose using `database` as Session Driver, then you need make some changes in `Illuminate\Session\DatabaseSessionHandler.php` +When using the `database` session driver, you will need to create a table to contain the session items. Below is an example `Schema` declaration for the table: +``` +Schema::create('sessions', function ($table) { + $table->string('id')->unique(); + $table->foreignId('user_id')->nullable(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->text('payload'); + $table->integer('last_activity'); +}); +``` + +You may use the `session:table` Artisan command to generate this migration: +``` +php artisan session:table + +php artisan migrate +``` + +Then you need make some changes in `Illuminate\Session\DatabaseSessionHandler.php` ``` ... protected function addUserInformation(&$payload) diff --git a/VERSION.md b/VERSION.md index c340d55..f9d55ba 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,26 +1,7 @@ ## Version 2.0.1 ### Changelog - Add support auth for Guzzle functions -- Add support Session Driver Database by make some changes in `Illuminate\Session\DatabaseSessionHandler.php` -``` -... -protected function addUserInformation(&$payload) -{ - if ($this->container->bound(Guard::class)) { - $payload['user_id'] = $this->userId(); - } - - // ADDED FOR LARA-S-CMS BY KINIDI TECH - BEGIN - if(\Session::has('admin')){ - $larascms_user = \Session::get('admin'); - $payload['user_id'] = $larascms_user->id; - } - // ADDED FOR LARA-S-CMS BY KINIDI TECH - END - - return $this; -} -... -``` +- Add support Session Driver Database - Add security update: if password has been changed, then force user to re-login - Add feature logout from all sessions diff --git a/database/migrations/2020_07_08_211522_create_sessions_table.php b/database/migrations/2020_07_08_211522_create_sessions_table.php deleted file mode 100644 index 0bd028c..0000000 --- a/database/migrations/2020_07_08_211522_create_sessions_table.php +++ /dev/null @@ -1,35 +0,0 @@ -string('id')->unique(); - $table->foreignId('user_id')->nullable(); - $table->string('ip_address', 45)->nullable(); - $table->text('user_agent')->nullable(); - $table->text('payload'); - $table->integer('last_activity'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('sessions'); - } -}