我试图使用电子邮件作为我的表的主键,所以我雄辩的代码是-
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class UserVerification extends Model
{
protected $table = 'user_verification';
protected $fillable = [
'email',
'verification_token'
];
//$timestamps = false;
protected $primaryKey = 'verification_token';
}
我的尸体是这样的
但如果我这么做
UserVerification::where('verification_token', $token)->first();
我明白了
{
"email": "sdfsdf@sdfsdf.sdf",
"verification_token": 0,
"created_at": "2016-01-03 22:27:44",
"updated_at": "2016-01-03 22:27:44"
}
所以 核实令牌/主键变成0。
有人能帮忙吗?