// User model
public function phone()
{
return $this->hasOne(Phone::class);
}
// User controller
$phone = User::find(1)->phone;
//Model Function
public function hasOneFunction(){
return $this->hasOne('AppModelsModelName', 'targetedId');
}
//in controller function
$data = ModelName::with('hasOneFunction')->get();
Doctor::has('DoctorMessage')->with('DoctorMessage')->get()