src/DataGrid/Manager.php
public function render($dataGrid)
    {
        if (null !== $this->request->get('q')) {
            foreach ($this->request->get('q') as $key => $val) {
                $dataGrid->model->where($key, 'like', '%' . $val . '%');
            }
        }

        $options = ['path' => asset(request()->path())];
        if (!$dataGrid->model instanceof Collection) {
            $dataGrid->data = $dataGrid->model->paginate(
                $this->pageItem,
                ['*'],
                $dataGrid->pageName()
            );

            if (null !== $this->request->get('asc')) {
                $dataGrid->model->orderBy($this->request->get('asc'), 'asc');
            }
            if (null !== $this->request->get('desc', 'id')) {
                $dataGrid->model->orderBy($this->request->get('desc', 'id'), 'desc');
            }
        } else {
            $dataGrid->data = $this->paginate(
                $dataGrid->model,
                $this->pageItem,
                null,
                $options
            );
        }

        return view('avored-framework::datagrid.grid')->with('dataGrid', $dataGrid);
    }
public function render($dataGrid)
    {
        if (null !== $this->request->get('q')) {
            foreach ($this->request->get('q') as $key => $val) {
                $dataGrid->model->where($key, 'like', '%' . $val . '%');
            }
        }

        $options = ['path' => asset(request()->path())];
        if (!$dataGrid->model instanceof Collection) {
            $dataGrid->data = $dataGrid->model->paginate(
                $this->pageItem,
                ['*'],
                $dataGrid->pageName()
            );

            if (null !== $this->request->get('asc')) {
                $dataGrid->model->orderBy($this->request->get('asc'), 'asc');
            }
            if (null !== $this->request->get('desc', 'id')) {
                $dataGrid->model->orderBy($this->request->get('desc', 'id'), 'desc');
            }
        } else {
            $dataGrid->data = $this->paginate(
                $dataGrid->model,
                $this->pageItem,
                null,
                $options
            );
        }

        return view('avored-framework::datagrid.grid')->with('dataGrid', $dataGrid);
    }
public function render ( $ dataGrid ) { if ( null !== $ this -> request -> get ( 'q' ) ) { foreach ( $ this -> request -> get ( 'q' ) as $ key => $ val ) { $ dataGrid -> model -> where ( $ key , 'like' , '%' . $ val . '%' ) ; } } $ options = [ 'path' => asset ( request ( ) -> path ( ) ) ] ; if ( ! $ dataGrid -> model instanceof Collection ) { $ dataGrid -> data = $ dataGrid -> model -> paginate ( $ this -> pageItem , [ '*' ] , $ dataGrid -> pageName ( ) ) ; if ( null !== $ this -> request -> get ( 'asc' ) ) { $ dataGrid -> model -> orderBy ( $ this -> request -> get ( 'asc' ) , 'asc' ) ; } if ( null !== $ this -> request -> get ( 'desc' , 'id' ) ) { $ dataGrid -> model -> orderBy ( $ this -> request -> get ( 'desc' , 'id' ) , 'desc' ) ; } } else { $ dataGrid -> data = $ this -> paginate ( $ dataGrid -> model , $ this -> pageItem , null , $ options ) ; } return view ( 'avored-framework::datagrid.grid' ) -> with ( 'dataGrid' , $ dataGrid ) ; }
Render the Datagrid by given datagrid object

@param \AvoRed\Framework\DataGrid\DataGrid
@return \Illuminate\View\View $response
Render the Datagrid by given datagrid object