I am trying to use email as my table's primary key, so my eloquent code is-
<?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';
}
And my DB is like this-
but if I do this-
UserVerification::where('verification_token', $token)->first();
I am getting this-
{"email":"sdfsdf@sdfsdf.sdf","verification_token":0,"created_at":"2016-01-03 22:27:44","updated_at":"2016-01-03 22:27:44"}
So, the verification token/primary key becomes 0.
Can anyone please help?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire