mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-06 08:51:10 +08:00
47 lines
950 B
PHP
47 lines
950 B
PHP
<?php
|
|
|
|
namespace App\Repos;
|
|
|
|
use App\Models\Config as ConfigModel;
|
|
|
|
class Config extends Repository
|
|
{
|
|
|
|
public function findItem($section, $key)
|
|
{
|
|
$result = ConfigModel::query()
|
|
->where('section = :section:', ['section' => $section])
|
|
->andWhere('item_key = :key:', ['key' => $key])
|
|
->execute()->getFirst();
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function findBySection($section)
|
|
{
|
|
$query = ConfigModel::query();
|
|
|
|
$query->where('section = :section:', ['section' => $section]);
|
|
|
|
$result = $query->execute();
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function findAll($where = [])
|
|
{
|
|
$query = ConfigModel::query();
|
|
|
|
$query->where('1 = 1');
|
|
|
|
if (isset($where['section'])) {
|
|
$query->andWhere('section = :section:', ['section' => $where['section']]);
|
|
}
|
|
|
|
$result = $query->execute();
|
|
|
|
return $result;
|
|
}
|
|
|
|
}
|