From c5f8754c9cda43ffb6ad06bef84857f9c844438f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bertu=C4=9F=20Fahri=20=C3=96ZER?= Date: Thu, 3 Aug 2023 19:28:21 +0300 Subject: [PATCH] or where added in lists method. --- app/Models/CommonModel.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php index 1cc07f2..0821c5a 100644 --- a/app/Models/CommonModel.php +++ b/app/Models/CommonModel.php @@ -17,12 +17,14 @@ public function __construct(string $group = 'default') * @param int $limit * @param int $pkCount * @param array $like + * @param array $orWhere * @return object */ - public function lists(string $table, string $select = '*', array $where = [], string $order = 'id ASC', int $limit = 0, int $pkCount = 0, array $like = []): array + public function lists(string $table, string $select = '*', array $where = [], string $order = 'id ASC', int $limit = 0, int $pkCount = 0, array $like = [],array $orWhere=[]): array { $builder = $this->db->table($table); $builder->select($select)->where($where); + if($orWhere) $builder->orWhere($orWhere); if (!empty($like)) { if (count($like) === 1) { $builder->like(key($like), reset($like));