| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- declare(strict_types=1);
- namespace Modules\ManageApi\Commands;
- use Illuminate\Console\Command;
- use App\Repositories\Utils\AccessControllerListsRepository;
- /**
- * @Command
- */
- class PermissionResourceCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'permission:resource';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '更新后台权限资源表';
- private $aclRepo = null;
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $authConfig = config('manage_acl');
- $this->getAclRepo()->getController(
- $authConfig,
- base_path(). '/Modules/ManageApi/Controllers',
- 'Controller',
- 'Modules\ManageApi\Controllers'
- );
- $this->line('更新权限资源完毕,可以去表[permission_resource]查看确认', 'info');
- }
- /**
- * 获取ACL仓库
- * @return AccessControllerListsRepository|null
- */
- private function getAclRepo()
- {
- if (empty($this->aclRepo)) {
- $this->aclRepo = make(AccessControllerListsRepository::class);
- }
- return $this->aclRepo;
- }
- }
|