how to set one to one relation in laravel model code 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;