Skip to content

Commit 63d8576

Browse files
committed
respect app config when publishing
1 parent f71371d commit 63d8576

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/DatabaseRepositoryServiceProvider.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,52 +62,62 @@ public function offerPublishing(): void
6262

6363
private function publishEnums(): void
6464
{
65+
$publishPath = $this->app->basePath(config('repository.path.relative.enums', 'app/Models/Enums/'));
66+
6567
$this->publishes([
66-
$this->baseModelStubPath.'/Enums/Enum.stub' => $this->app->basePath('app/Models/Enums/Enum.php'),
68+
$this->baseModelStubPath . '/Enums/Enum.stub' => $publishPath . 'Enum.php',
6769
], ['repository-base-classes', 'repository-base-enum']);
6870

6971
$this->publishes([
70-
$this->baseModelStubPath.'/Enums/GriewFilterOperator.stub' => $this->app->basePath('app/Models/Enums/GriewFilterOperator.php'),
72+
$this->baseModelStubPath . '/Enums/GriewFilterOperator.stub' => $publishPath . 'GriewFilterOperator.php',
7173
], ['repository-base-classes', 'repository-griew-enums']);
7274
}
7375

7476
private function publishEntities(): void
7577
{
78+
$publishPath = $this->app->basePath(config('repository.path.relative.entities', 'app/Models/Entities/'));
79+
7680
$this->publishes([
77-
$this->baseModelStubPath.'/Entity/Entity.stub' => $this->app->basePath('app/Models/Entities/Entity.php'),
81+
$this->baseModelStubPath . '/Entity/Entity.stub' => $publishPath . 'Entity.php',
7882
], ['repository-base-classes', 'repository-base-entity']);
7983
}
8084

8185
private function publishFactories(): void
8286
{
87+
$publishPath = $this->app->basePath(config('repository.path.relative.factories', 'app/Models/Factories/'));
88+
8389
$this->publishes([
84-
$this->baseModelStubPath.'/Factory/Factory.stub' => $this->app->basePath('app/Models/Factories/Factory.php'),
90+
$this->baseModelStubPath . '/Factory/Factory.stub' => $publishPath . 'Factory.php',
8591
], ['repository-base-classes', 'repository-base-factory']);
8692

8793
$this->publishes([
88-
$this->baseModelStubPath.'/Factory/IFactory.stub' => $this->app->basePath('app/Models/Factories/IFactory.php'),
94+
$this->baseModelStubPath . '/Factory/IFactory.stub' => $publishPath . 'IFactory.php',
8995
], ['repository-base-classes', 'repository-base-factory']);
9096
}
9197

9298
private function publishResources(): void
9399
{
100+
$publishPath = $this->app->basePath(config('repository.path.relative.resources', 'app/Models/Resources/'));
101+
94102
$this->publishes([
95-
$this->baseModelStubPath.'/Resource/Resource.stub' => $this->app->basePath('app/Models/Resources/Resource.php'),
103+
$this->baseModelStubPath . '/Resource/Resource.stub' => $publishPath . 'Resource.php',
96104
], ['repository-base-classes', 'repository-base-resource']);
97105

98106
$this->publishes([
99-
$this->baseModelStubPath.'/Resource/IResource.stub' => $this->app->basePath('app/Models/Resources/IResource.php'),
107+
$this->baseModelStubPath . '/Resource/IResource.stub' => $publishPath . 'IResource.php',
100108
], ['repository-base-classes', 'repository-base-resource']);
101109
}
102110

103111
private function publishRepositories(): void
104112
{
113+
$publishPath = $this->app->basePath(config('repository.path.relative.repositories', 'app/Models/Repositories/'));
114+
105115
$this->publishes([
106-
$this->baseModelStubPath.'/Repository/MySqlRepository.stub' => $this->app->basePath('app/Models/Repositories/MySqlRepository.php'),
116+
$this->baseModelStubPath . '/Repository/MySqlRepository.stub' => $publishPath . 'MySqlRepository.php',
107117
], ['repository-base-classes', 'repository-base-mysql-repository']);
108118

109119
$this->publishes([
110-
$this->baseModelStubPath.'/Repository/RedisRepository.stub' => $this->app->basePath('app/Models/Repositories/RedisRepository.php'),
120+
$this->baseModelStubPath . '/Repository/RedisRepository.stub' => $publishPath . 'RedisRepository.php',
111121
], ['repository-base-classes', 'repository-base-redis-repository']);
112122
}
113123

0 commit comments

Comments
 (0)