<?php

namespace App\Models\Master;

use CodeIgniter\Model;

class MarketplaceModel extends Model
{
    protected $table            = 'tb_marketplace';
    protected $primaryKey       = 'id_marketplace';
    protected $useAutoIncrement = true;
    protected $returnType       = 'array';
    protected $useSoftDeletes   = false;
    protected $protectFields    = true;
    protected $allowedFields    = [
        'nama_marketplace',
        'url_marketplace',
        'komisi_marketplace',
        'kontak_marketplace',
        'catatan_marketplace',
        'status_marketplace',
    ];

    protected $useTimestamps = true;
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at'; // ← ada kolomnya, isi dengan nama kolom
    protected $deletedField  = '';

    public function getActive()
    {
        return $this->where('status_marketplace', 'Aktif')->findAll();
    }
}