mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
update
This commit is contained in:
parent
b953b7fd38
commit
c37a6226ae
4 changed files with 64 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Docker\App\Listeners;
|
||||
|
||||
|
||||
use App\Events\ModuleIsInstalled;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class ModuleIsInstalledListener
|
||||
{
|
||||
public function handle(ModuleIsInstalled $event): void
|
||||
{
|
||||
if ($event->module->name === 'Docker') {
|
||||
Artisan::call('docker:search-images redis');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,12 +2,17 @@
|
|||
|
||||
namespace Modules\Docker\App\Providers;
|
||||
|
||||
use App\Events\DomainIsCreated;
|
||||
use App\Events\ModuleIsInstalled;
|
||||
use BladeUI\Icons\Factory;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Docker\App\Console\DockerContainers;
|
||||
use Modules\Docker\App\Console\DockerRunImage;
|
||||
use Modules\Docker\App\Console\DockerSearchImages;
|
||||
use Modules\Docker\App\Listeners\ModuleIsInstalledListener;
|
||||
use Modules\LetsEncrypt\Listeners\DomainIsCreatedListener;
|
||||
|
||||
class DockerServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -26,6 +31,8 @@ class DockerServiceProvider extends ServiceProvider
|
|||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
||||
|
||||
Event::listen(ModuleIsInstalled::class,ModuleIsInstalledListener::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
37
web/app/Events/ModuleIsInstalled.php
Normal file
37
web/app/Events/ModuleIsInstalled.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ModuleIsInstalled
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $module;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct($model)
|
||||
{
|
||||
$this->module = $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new PrivateChannel('channel-name'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use App\Events\ModuleIsInstalled;
|
||||
use App\Models\Module;
|
||||
|
||||
class ModulesManager
|
||||
|
@ -74,5 +75,7 @@ class ModulesManager
|
|||
$newModule->namespace = 'Modules\\' . $module;
|
||||
$newModule->installed = 1;
|
||||
$newModule->save();
|
||||
|
||||
event(new ModuleIsInstalled($newModule));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue