<?php

namespace App\Services;

use App\Owner;
use App\Procurement;
use App\ProcurementTotalBill;
use App\Services\common\QueryService;
use Illuminate\Support\Facades\Auth;
use App\Traits\ServiceAppAop;


class ProcurementTotalBillService
{
    use ServiceAppAop;

    private function conditionQuery(array $param){
        $procurementTotalBills=ProcurementTotalBill::query()->with('supplier')->orderByDesc('id');
        $columnQueryRules=[
            'supplier_id' => ['multi' => ','],
            'counting_month' => ['like' => ''],
        ];
        $procurementTotalBills = app(QueryService::class)->query($param,$procurementTotalBills,$columnQueryRules,"procurement_total_bills");
        return $procurementTotalBills;
    }

    public function paginate(array $param){
        $procurementTotalBills = $this->conditionQuery($param);
        return $procurementTotalBills->paginate($param['paginate'] ?? 50);
    }
    public function get(array $params){
        return $this->conditionQuery($params)->get();
    }
}
