laravel中的激活链接

时间:2015-03-04 13:31:47

标签: php laravel

我正试图在laravel的帮助下向注册用户发送激活链接。我在User.php

中做了一些更改
  

“User :: setRememberToken()声明必须兼容   照亮\验证\的UserInterface :: setRememberToken($值)“

这个错误即将到来。     我的User.php如下:

<?php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface {

    //use UserTrait, RemindableTrait;
    protected $fillable =array('email','username','password','password_temp','code','active');

    /**
     * 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 identifier for user
     *
     * @return mixed
     */
    public function getAuthIdentifier()
    {
        return $this->getKey();
    }
    /**
     * get the password for user
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->password;
    }
    /**
     * get the email add where password is sent
     *
     * @return string
     */
    public function getRemainderEmail()
    {
        return $this->email;
    }

    public function getRememberToken(){}
    public function setRememberToken(){}
    public function getReminderEmail(){}

}

1 个答案:

答案 0 :(得分:1)

如果您查看setRememberToken的文档,就可以看到它的签名为void setRememberToken(string $value)。所以,你的代码改变了

public function setRememberToken(){}

public function setRememberToken($value){}