Laravel filter reset after next page click in paginate

前端 未结 2 1268
野趣味
野趣味 2020-12-12 08:33

I have create table where showing data. I also add few filters to filter data. Using paginate i show 20 records per page. After select filter and click search records in tab

相关标签:
2条回答
  • 2020-12-12 08:37

    try to use in your Blade view

    $orders->links()
    
    0 讨论(0)
  • 2020-12-12 09:02

    Try to append the request in the results:

    public function index(Request $request){
        try {
            $companies = (new Company())->showAllCompanyWithName(['name' => 'ASC'], false);
            $orders = (new Agos())->index();
            $queryArgs = Input::only(['status','company','from_date', 'to_date']);
            $orders->appends($queryArgs);
        } catch (InvalidArgumentException $e) {
            return Utility::httpExceptionHandler(500, $e);
        } catch (Exception $e) {
            return Utility::httpExceptionHandler(500, $e);
        }
    
        $view = SmartView::render(null, compact($this->singular(), $this->plural(), 'companies', 'orders'));
    
        return $view;
    }
    

    Then in your template:

    <div class="pagination-container">
          {!! $orders->render(); !!}
    </div>
    
    0 讨论(0)
提交回复
热议问题