user --- phone
|
|
.
comment
/
post ------ comment
\
comment
|
|
.
user role
\ /
user --------- role
/ \
user role
|
|
mechanic -------- car -------- owner
class Mechanic extends Model
{
public function carOwner()
{
return $this->hasOneThrough(
Owner::class,
Car::class,
'mechnic_id', // foreign key on cars tabiel
'car_id', // foreign key on owners table
'id', // local key on mechics table
'id' // local key on cars table
);
}
}
.
environment deployment
/ /
project -------- environment --------- deployment
\ \
environment deployment
class Project extends Model
{
public function deployments()
{
return $this->hasManyThrough(
Deployment::class,
Environment::class,
'project_id', // foreign key on enviorments tabie
'environment_id', // foreign key on deployments table
'id', // local key on projects table
'id' // local key on environments table
);
}
}
. ----------- user
/
image -----=
\
----- post
|
|
.
comment ----------- video
\ /
comment ------=
/ \
comment --- post
|
|
.
video
/
tag -------------- video
\ / \
tag -------= video
/ \ post
tag \ /
----- post
\
post
|
|