1

I want create one-to-one relationship into two tables.

One of my tables have column typed in int but the second have foreign key column typed in string.

Into database :

user table: 
id: int

life table:
user_id: string 

in User model :

public function life(Builder $query): HasOne
{
    return $query->hasOne(Life::class, 'user_id', 'id');
}

Any help is appreciated to answer my question

0 Answers0