assuming your talking about is eloquent relationship something like this !
// get all the contractors with skiil levels
Contractor::with('skills.skill','skills.level')->get();
/*
contractor
name // john doe
address // some place
skills
skill_id // 1
contractor_id // 1
skill
title // php
level
title // senior
*/
Class Contractor extends Model {
public function skills()
{
return $this->hasMany('ContractorSkillLevel');
}
}
Class ContractorSkillLevel extends Model {
public function skill()
{
// this is assuming you already have the Skill Module
return $this->belongsTo('Skill');
}
public function level()
{
// this is assuming you already have the Level Module
return $this->belongsTo('Level');
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community