public function index($params = [])
    {
        // Set the filters
        $params = (!empty($params))? $params : $this->app->request->input();

        // Get records
        $this->model->params = $params;
        $result = $this->model->search($params)->get();

        // Get pagination and number of records
        $pagination = array_merge(
            ['records' => $this->model->search($params)->count()],
            $this->model->pagination()
        );

        // Return results
        return [
            'success' => true,
            'paging' => $pagination,
            'data' => $result
        ];
    }
public function index($params = [])
    {
        // Set the filters
        $params = (!empty($params))? $params : $this->app->request->input();

        // Get records
        $this->model->params = $params;
        $result = $this->model->search($params)->get();

        // Get pagination and number of records
        $pagination = array_merge(
            ['records' => $this->model->search($params)->count()],
            $this->model->pagination()
        );

        // Return results
        return [
            'success' => true,
            'paging' => $pagination,
            'data' => $result
        ];
    }
public function index ( $ params = [ ] ) { // Set the filters $ params = ( ! empty ( $ params ) ) ? $ params : $ this -> app -> request -> input ( ) ; // Get records $ this -> model -> params = $ params ; $ result = $ this -> model -> search ( $ params ) -> get ( ) ; // Get pagination and number of records $ pagination = array_merge ( [ 'records' => $ this -> model -> search ( $ params ) -> count ( ) ] , $ this -> model -> pagination ( ) ) ; // Return results return [ 'success' => true , 'paging' => $ pagination , 'data' => $ result ] ; }
Display a listing of the resource

@param array $params Listing parameters
@return array Response
Display a listing of the resource