30 lines
777 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[] = [
2022-12-16 18:30:36 +08:00
'label' => Str::of(File::name($controllerFile))->lcfirst()->remove('Controller'),
2022-12-10 18:29:42 +08:00
2022-12-16 18:30:36 +08:00
'value' => Str::of(File::name($controllerFile))->lcfirst()->remove('Controller'),
2022-12-10 18:29:42 +08:00
];
}
}
return $controllers;
}
}