<?php 

namespace App\Models;

use CodeIgniter\Model;

class FourchettePrix extends Model
{
    protected $table;
    protected $primaryKey = 'id';
    protected $allowedFields = ['product_id', 'prix_minimal'];

    public function __construct()
    {
        $this->table = 'fourchette_prix';
        parent::__construct();
    }

    public function getFourchettePrixByProductId($productId)
    {
        return $this->where('product_id', $productId)->first();
    }

    public function createFourchettePrix($data)
    {
        return $this->insert($data);
    }
}