Files
MrleeAdmin/backend/plugin/produce/app/dao/ProcessDao.php
T

43 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace plugin\produce\app\dao;
use core\base\BaseDao;
use Illuminate\Database\Eloquent\Collection;
use plugin\produce\app\model\Process;
class ProcessDao extends BaseDao
{
protected function setModel(): string
{
return Process::class;
}
public function selectList(
array $where,
string|array $field = '*',
int $page = 0,
int $limit = 0,
string $order = '',
array $with = [],
bool $search = false,
?array $withoutScopes = null
): ?Collection {
$query = $this->selectModel($where, $field, $page, $limit, $order, $with, $search, $withoutScopes);
$query->withCount(['steps as step_count']);
if ($page > 0 && $limit > 0) {
return $query->paginate($limit, ['*'], 'page', $page)->getCollection();
}
return $query->get();
}
protected function getKeywordFields(): array
{
return ['process_code', 'process_name', 'description'];
}
}