2025-01-21 14:57:54 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
|
|
use App\Models\Plugin;
|
2025-05-22 17:58:22 +08:00
|
|
|
use App\Services\Plugin\HookManager;
|
2025-01-21 14:57:54 +08:00
|
|
|
use App\Services\Plugin\PluginManager;
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
2025-01-26 11:41:53 +08:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2025-05-22 17:58:22 +08:00
|
|
|
use Laravel\Octane\Events\WorkerStarting;
|
2025-01-21 14:57:54 +08:00
|
|
|
|
|
|
|
|
class PluginServiceProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
public function register(): void
|
|
|
|
|
{
|
|
|
|
|
$this->app->scoped(PluginManager::class, function ($app) {
|
|
|
|
|
return new PluginManager();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function boot(): void
|
|
|
|
|
{
|
2026-04-18 23:31:19 +08:00
|
|
|
foreach (['plugins', 'plugins-core'] as $dir) {
|
|
|
|
|
$path = base_path($dir);
|
|
|
|
|
if (!file_exists($path)) {
|
|
|
|
|
mkdir($path, 0755, true);
|
|
|
|
|
}
|
2025-01-21 14:57:54 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|