first commit

This commit is contained in:
2026-02-15 01:34:17 +07:00
commit baac22e3ae
95 changed files with 13238 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Providers;
use App\Contracts\WbClientInterface;
use App\Contracts\WbSyncFactoryInterface;
use App\Contracts\WbSyncManagerInterface;
use App\Services\WbService\WbClient;
use App\Services\WbService\WbSyncFactory;
use App\Services\WbService\WbSyncManager;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
$this->registerSyncServices();
$this->app->bind(WbSyncManagerInterface::class, WbSyncManager::class);
$this->app->bind(WbClientInterface::class, WbClient::class);
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
private function registerSyncServices(): void
{
$syncServices = config('wb-sync.services');
foreach ($syncServices as $serviceClass) {
$this->app->singleton($serviceClass);
}
$this->app->singleton(WbSyncFactoryInterface::class, function ($app) use ($syncServices) {
$services = array_map(function ($serviceClass) use ($app) {
return $app->make($serviceClass);
}, $syncServices);
return new WbSyncFactory($services);
});
}
}