Problem solved
My Solution:
My code in ModelC Controller:
$data = ModelC::with('modelB')->get();
Relation function in ModelB:
public function modelA(){
return $this->belongsTo(ModelA::class);
}
Relation function in ModelC:
public function modelB(){
return $this->belongsTo(ModelB::class)->with('modelA');
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…