I have 2 tables:
User | Doctor
---------- | ----------
id | id
email | user_id
name | signature
last_name | photo
password | description
date_birth |
每Doctor
与User
相关,但每User
不一定与Doctor
相关.我这样做是因为我不想使用单表继承,最终得到NULL
个字段.
Is there a way to make, something like this?
// Instead of
$doctor = Doctor::with('User')->find(1);
$doctor->user->name;
// This
$doctor = Doctor::find(1);
$doctor->name;
附言:我不知道该在标题中写些什么,我应该写些什么,这样它才与问题更相关?