laravel foreach loop with 2k and get relation from 200k tack long long time
i have this model called Product and i have model called Note_voucher_line and this is relation inside product public function get_note_voucher_lines() { return $this->hasMany('AppModelsNote_voucher_line','product_id','id')->orderBy('date','asc')->orderBy('note_voucher_id','asc'); } now sometimes i have to loop products like this code $products = Product::whereBetween('id',[$num1,$num2])->get(); foreach($products as…