<?php

namespace App\Models;

use CodeIgniter\Model;

class Saran_model extends Model
{
    protected $table         = 'kritik_saran';
    protected $primaryKey    = 'id_saran';
    protected $allowedFields = [];

    // tambah
    public function tambah($data)
    {
        $builder = $this->db->table('kritik_saran');
        $builder->insert($data);
    }
    
    public function get_data()
    {
        $builder = $this->db->table('kritik_saran');
        $builder->select('*');
        $builder->orderBy('id_saran', 'DESC');
        $builder->limit(25);
        $query = $builder->get();

        return $query->getResultArray();
    }

}
