/** * the constructor takes the model and values passes in, assigns values to internal * vars, sets up the offset and limit on the model and use this->paginate * calls parent __construct * @param string $WaxModel * @param string $page * @param string $per_page */ public function __construct(WaxModel $model, $page, $per_page) { $this->per_page = $per_page; $this->current_page = $page; //setup model $this->model = $model; $this->model->offset = ($page - 1) * $per_page; $this->model->limit = $per_page; //paginate the model $rowset = $this->paginate($model); $this->set_count($model->total_without_limits); parent::__construct($model, $rowset); }