mirror of
https://github.com/zoe-may/TDoG-Skin.git
synced 2024-11-24 13:52:19 +08:00
29 lines
636 B
PHP
Executable File
29 lines
636 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Services\Plugin;
|
|
use Illuminate\Filesystem\Filesystem;
|
|
|
|
class CopyPluginAssets
|
|
{
|
|
protected Filesystem $filesystem;
|
|
|
|
public function __construct(Filesystem $filesystem)
|
|
{
|
|
$this->filesystem = $filesystem;
|
|
}
|
|
|
|
public function handle($event)
|
|
{
|
|
$plugin = $event instanceof Plugin ? $event : $event->plugin;
|
|
$dir = public_path('plugins/'.$plugin->name);
|
|
$this->filesystem->deleteDirectory($dir);
|
|
|
|
$this->filesystem->copyDirectory(
|
|
$plugin->getPath().DIRECTORY_SEPARATOR.'assets',
|
|
$dir.'/assets'
|
|
);
|
|
}
|
|
}
|