what is one to one relationship in laravel example
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;