blessing-skin-server/app/Console/Commands/PluginEnableCommand.php
2020-06-30 11:03:54 +08:00

27 lines
728 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\PluginManager;
use Illuminate\Console\Command;
class PluginEnableCommand extends Command
{
protected $signature = 'plugin:enable {name}';
protected $description = 'Enable a plugin';
public function handle(PluginManager $plugins)
{
$name = $this->argument('name');
$result = $plugins->enable($name);
if ($result === true) {
$plugin = $plugins->get($name);
$title = trans($plugin->title);
$this->info(trans('admin.plugins.operations.enabled', ['plugin' => $title]));
} elseif ($result === false) {
$this->warn(trans('admin.plugins.operations.not-found'));
}
}
}