How to give alias in replated table hasMany relationship.
Controller
$templates = UserMaster::where ( 'INACTIVE', '=', 0 )->with('contact')->get ();
Model
public function contact(){
return $this->hasMany(\App\Models\Contact::class,'CONTACT_ID');
}
I can try this code my but give error
$templates = UserMaster::where ( 'INACTIVE', '=', 0 )->with('contact as CONTACT')->get ();
So how give alias in with query?
Thank you