<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Admin\Repository; use Illuminate\Support\Collection; use ModStart\Grid\Model; use ModStart\Module\ModuleManager; use ModStart\Module\ModuleStatus; use ModStart\Repository\Repository; use ModStart\Repository\RepositoryUtil; class ModuleRepository extends Repository { protected $keyName = 'name'; public function get(Model $pWRTh) { goto Tz2n5; KyYX0: return $Ayu2S->filter(function ($Nrp0b) use($ZqQec) { if (empty($ZqQec)) { return true; } foreach ($ZqQec as $U9AsU => $ohYVl) { switch ($U9AsU) { case 'type': if ($Nrp0b->type != $ohYVl) { return false; } break; case 'status': switch ($ohYVl) { case ModuleStatus::INSTALLED: return ModuleManager::isModuleInstalled($Nrp0b->name); case ModuleStatus::NOT_INSTALLED: return !ModuleManager::isModuleInstalled($Nrp0b->name); } break; case 'keywords': goto cNrMK; Nx186: break; goto Efs9z; cNrMK: $ohYVl = strtolower(trim($ohYVl, '%')); goto s_Lpz; s_Lpz: if (!str_contains(strtolower($Nrp0b->name), $ohYVl) && !str_contains(strtolower($Nrp0b->title), $ohYVl)) { return false; } goto Nx186; Efs9z: } } return true; }); goto yeWzm; ctBxf: foreach ($pWRTh->filter()->getConditions() as $eVURJ) { if (!empty($eVURJ['where'][2])) { $ZqQec[$eVURJ['where'][0]] = $eVURJ['where'][2]; } } goto ua3ak; Tz2n5: $ZqQec = array(); goto ctBxf; ua3ak: $Ayu2S = RepositoryUtil::itemsFromArray(ModuleManager::listLocalModules()); goto KyYX0; yeWzm: } }