CodeIgniter Forums

Full Version: Pagination don't work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all!
I'm trying to configure pagination for my project, I do everything according to the documentation, but I get an error. With version 3, there were no such problems ((

PHP Code:
lass User extends Controller{
public $model;
    public $locale;

    function __construct()
        $this->locale  =  service('request')->getLocale();
        $this->model = new UserModel();

     * Listing of users
    function index()

        $data = [
            'locale' => $this->locale

        echo view('admin/header',$data);
        echo view('admin/user/index',$data);
        echo view('admin/footer');

PHP Code:
class UserModel extends Model
    protected $db;
    protected $builder;

    function __construct()
        $this->db = \Config\Database::connect();
        $this->builder $this->db->table('users');
     * Get all users
    function get_all_users()

//        $this->builder->select('id_user, name_user');

        return $this->builder->get()->getResultArray();

Call to a member function paginate() on array search →
as it turned out, in the file \system\Model.php, line 442

$ this-> tempReturnType = $ this-> returnType; costs AFTER $ row = $ row-> getResult ($ this-> tempReturnType); I moved it before this expression and it worked.