30 lines
755 B
PHP
Raw Normal View History

2022-12-10 18:29:42 +08:00
<?php
2022-12-14 19:25:52 +08:00
2022-12-10 18:29:42 +08:00
namespace Modules\Options\Repository;
use Catch\CatchAdmin;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class Controllers implements OptionInterface
{
public function get(): array
{
$controllers = [];
if ($module = request()->get('module')) {
2022-12-14 19:25:52 +08:00
$controllerFiles = File::glob(CatchAdmin::getModuleControllerPath($module).'*.php');
2022-12-10 18:29:42 +08:00
foreach ($controllerFiles as $controllerFile) {
$controllers[] = [
'label' => Str::of(File::name($controllerFile))->remove('Controller'),
'value' => Str::of(File::name($controllerFile))->remove('Controller'),
];
}
}
return $controllers;
}
}