Skip to content

Instantly share code, notes, and snippets.

@denvers
Last active August 29, 2015 13:59
Show Gist options
  • Save denvers/10828426 to your computer and use it in GitHub Desktop.
Save denvers/10828426 to your computer and use it in GitHub Desktop.
Laravel upgrade to 4.1.26
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNullableRememberTokenToUser extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table) {
$table->text("remember_token")->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function($table) {
$table->dropColumn("remember_token");
});
}
}
<?php
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use \Eloquent;
class User extends Eloquent implements UserInterface, RemindableInterface
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password');
/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthIdentifier()
{
return $this->getKey();
}
/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword()
{
return $this->password;
}
/**
* Get the e-mail address where password reminders are sent.
*
* @return string
*/
public function getReminderEmail()
{
return $this->email;
}
// Added for Laravel 4.1.26 upgrade
public function getRememberToken()
{
return $this->remember_token;
}
public function setRememberToken($value)
{
$this->remember_token = $value;
}
public function getRememberTokenName()
{
return 'remember_token';
}
}
@denvers
Copy link
Author

denvers commented Apr 16, 2014

Code changes based on documentation at http://laravel.com/docs/upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment