42c10d7856
at artisan CLI
27 lines
728 B
PHP
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'));
|
|
}
|
|
}
|
|
}
|