mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-09 16:19:35 +01:00
add artisan command to update plugin
This commit is contained in:
parent
a741be7226
commit
be404a8332
36
app/Console/Commands/Plugin/UpdatePluginCommand.php
Normal file
36
app/Console/Commands/Plugin/UpdatePluginCommand.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Plugin;
|
||||||
|
|
||||||
|
use App\Facades\Plugins;
|
||||||
|
use App\Models\Plugin;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class UpdatePluginCommand extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'p:plugin:update {id}';
|
||||||
|
|
||||||
|
protected $description = 'Updates a plugin';
|
||||||
|
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
/** @var ?Plugin $plugin */
|
||||||
|
$plugin = Plugin::where('id', $this->argument('id'))->first();
|
||||||
|
|
||||||
|
if (!$plugin) {
|
||||||
|
$this->error('Plugin does not exist!');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$plugin->isUpdateAvailable()) {
|
||||||
|
$this->error("Plugin doesn't need updating!");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plugins::updatePlugin($plugin);
|
||||||
|
|
||||||
|
$this->info('Plugin updated.');
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user