one to one relationship example in laravel
Example: laravel relation one to one
// User model
public function phone()
{
return $this->hasOne(Phone::class);
}
// User controller
$phone = User::find(1)->phone;
// User model
public function phone()
{
return $this->hasOne(Phone::class);
}
// User controller
$phone = User::find(1)->phone;