将.links()添加到多联接

时间:2018-12-28 00:08:59

标签: php laravel

我们可以将.links()添加到多联接查询中吗,我这样做了,但是它给出了一个错误,提示说Methodes libks不存在。

public function index(Request $request)
{
    $data   = array();
    $data   = array(
                "page_title"=>$this->plural." List",
                "page_heading"=>$this->plural.' List',
                "breadcrumbs"=>array("#"=>$this->plural." List")
            );
    if($request->perpage)
        $this->perpage = $request->perpage;

    $records    =   Purchases::select('purchases.*','plots.Name','customers.first_name','customers.last_name')
                                ->join('customers', 'customers.cus_id', '=', 'purchases.cus_id')
                                ->join('plots', 'plots.plo_id', '=', 'purchases.plo_id')
                                ->orderBy('pur_id','desc')
                                ->get();
    $data['list']  = $records->toArray();
    $links = $records->links();
    $data['list']['pagination'] = $links;

    $data['module'] = ['type'=>$this->type,'singular'=>$this->singular,'plural'=>$this->plural,'view'=>$this->view,'action'=>$this->action,'db_key'=>$this->db_key];
    $plots       =   Plots::get()->toArray();
    foreach ($plots as $key=>$val) {
        $data['plots'][$val['plo_id']] = $val;
    }
    dd($records);
    return view($this->view.'list',$data);
}

0 个答案:

没有答案