Files
2026-08-08 18:28:49 +08:00

36 lines
773 B
PHP

<?php
namespace app\models;
use core\base\Model;
/**
* 供应商模型
*/
class Supplier extends Model
{
protected $table = 'supplier';
public function getAll()
{
return $this->order(['id DESC'])->fetchAll();
}
public function getActiveList()
{
return $this->where(['status = 1'])->order(['name ASC'])->fetchAll();
}
public function getById($id)
{
return $this->where(['id = :id'], [':id' => $id])->fetch();
}
public function search($keyword)
{
return $this->where(
['name LIKE :kw OR contact_person LIKE :kw2 OR phone LIKE :kw3'],
[':kw' => "%{$keyword}%", ':kw2' => "%{$keyword}%", ':kw3' => "%{$keyword}%"]
)->order(['id DESC'])->fetchAll();
}
}