skip to Main Content

Search Query by Child field Eloquent relation – Laravel

My Product Model is public function IncomeRepo(){ return $this->hasMany(Income::class,'Product'); } My Income Report Model Is public function ProductData(){ return $this->belongsTo(Product::class,'Product','id'); } My Query is public function SearchIncomeData(Request $request){ $GetFromDate = $request->FromDate; $GetToDate = $request->ToDate; $ProductData = Product::with('IncomeRepo')->whereBetween('created_at', [$GetFromDate, $GetToDate])->get(); return…

VIEW QUESTION
Back To Top
Search