I have a problem with laravel orm. I have three tables table A(id,.......), Table B(id, A_id ,C_id,.....), table C(id,....). and table A and B has one to many relation and table B and C have one to one relation. How can I use hasMany on C from table A. Like
class aModel {
function b(){
return hasMany(app\Models\bModel');
}
// i want to do this
function c(){
return hasMany('App\Models\cModel');
}
}
class bModel{
function a(){
return belongsTo('App\Models\aModel);
}
function c(){
return belngsTo('App\Models\cModel');
}
}
like aModel::with(['b'])->get(); i want.
$a = aModel::with( ['c] )->get();
anyone please................