use Data namespace
This commit is contained in:
parent
71d49def6b
commit
a5b80681c9
21 changed files with 283 additions and 68 deletions
|
|
@ -1,23 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Icefox\DTO\Providers;
|
||||
namespace Icefox\Data\Providers;
|
||||
|
||||
use Icefox\DTO\Factories\DataObjectFactory;
|
||||
use Icefox\DTO\IDataObject;
|
||||
use Icefox\Data\Factories\DataObjectFactory;
|
||||
use Icefox\Data\IData;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class DataObjectServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->publishes([
|
||||
__DIR__ . '../../workbench/config/dto.php' => config_path('dto.php'),
|
||||
]);
|
||||
|
||||
$this->app->beforeResolving(function ($abstract, $parameters, $app) {
|
||||
if ($app->has($abstract)) {
|
||||
return;
|
||||
}
|
||||
if (is_subclass_of($abstract, IDataObject::class)) {
|
||||
if (is_subclass_of($abstract, IData::class)) {
|
||||
$app->bind($abstract, fn($container) => DataObjectFactory::fromRequest($abstract, $container['request']));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue