vendredi 24 juin 2022

Call to a member function links() on array_push in laravel

I'm sending the two different queries resulting in one parameter using the array push method that time laravel pagination is not working. Without pagination queries working fine. I don't know what was the issue please help me how to fix this issue

My Query

public function searchProduct(Request $request)
{
$pro = array();
        foreach ($catePro as $cateProCode)
        {
            //dd($cateProCode);

            $max = DB::table('product')
                ->select(['product.prod_product_code', DB::raw('MAX(quab_quantity) AS qty')])
                ->LeftJoin('quantity_break', 'quab_product_code', '=', 'prod_product_code')
                ->where('prod_product_code', '=', $cateProCode->catpro_prod_code)
                ->paginate(12);


            foreach ($max as $wt)
            {
                $maCode = DB::table('product')
                    ->join('quantity_break', 'quab_product_code', '=', 'prod_product_code')
                    ->join('supplier','supp_code','=','prod_supplier_code')
                    ->select('prod_product_code','prod_supplier_code', 'product_name', 'prod_image1', 'prod_from_price', 'quab_quantity','supp_margin','prod_supp_margin','prod_seo_title')
                    ->where('prod_product_code', '=', $wt->prod_product_code)
                    ->where('quab_quantity', '=', $wt->qty)->where('supp_flag','=','1')
                    ->orderBy('supp_seq_no','ASC')
                    ->paginate(12);

                array_push($pro, $maCode);
                
                //$data = $this->paginate(array_push($pro, $maCode));

            }
        }

        $sysfromPrice = sysmaster::where('sysm_def_id','from_price')->first();

        $subCateList = sub_category_one::where('suco_flag','1')->orderBy('suco_name')->get();

        return view('search_product')->with(['subCateList'=>$subCateList,'pro'=>$pro,'subCate'=>$subCate,'cateInfo'=>$cate,'sysfromPrice'=>$sysfromPrice,'suppList'=>$suppList]);
    }

Frontend

{!! $pro->links() !!}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire