From 7b4815c4a779e227fb9283ea4d43b65a316a4b6c Mon Sep 17 00:00:00 2001 From: Maks Surguy Date: Thu, 17 Apr 2014 11:31:03 -0700 Subject: [PATCH] Added remember me column and methods Per Laravel 4.1.26 release tightening application security, the users table require a remember me column and methods to set the remember me hash in the DB instead of in the cookie. Read more at http://laravel.com/docs/upgrade#upgrade-4.1.26 --- app/Tricks/User.php | 30 ++++++++++++++++ ...4_17_181442_add_remember_to_user_table.php | 34 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 app/database/migrations/2014_04_17_181442_add_remember_to_user_table.php diff --git a/app/Tricks/User.php b/app/Tricks/User.php index 097e014..f9d3338 100644 --- a/app/Tricks/User.php +++ b/app/Tricks/User.php @@ -69,6 +69,36 @@ public function votes() return $this->belongsToMany('Tricks\Trick', 'votes'); } + /** + * Get the remember me token from DB + * + * @return mixed + */ + public function getRememberToken() + { + return $this->remember_token; + } + + /** + * Set the remember me token to DB + * + * @return mixed + */ + public function setRememberToken($value) + { + $this->remember_token = $value; + } + + /** + * Get the column of remember me token in DB + * + * @return mixed + */ + public function getRememberTokenName() + { + return 'remember_token'; + } + /** * Get the unique identifier for the user. * diff --git a/app/database/migrations/2014_04_17_181442_add_remember_to_user_table.php b/app/database/migrations/2014_04_17_181442_add_remember_to_user_table.php new file mode 100644 index 0000000..b626d9c --- /dev/null +++ b/app/database/migrations/2014_04_17_181442_add_remember_to_user_table.php @@ -0,0 +1,34 @@ +string('remember_token',100)->nullable()->after('id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function($table) + { + $table->dropColumn('order'); + }); + } + +} \ No newline at end of file