I am using Laravel 5.2. Why can I submit more than one record in a one-to-one relationship? There are two tables, user
and profile
, and they have a one-to-one relationship.
User:
class User extends Authenticatable
{
public function profile()
{
return $this->hasOne(Profile::class);
}
}
Profile:
class Profile extends Model
{
public function user()
{
return $this->belongsTo(User::class);
}
}
I've setup the one-to-one relationship, but I can submit more than one record into table profile
by one user account. Why is this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire