Skip to content

Commit 51a79f2

Browse files
committed
refactor: load entity
1 parent 1bd22cc commit 51a79f2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Entities/Domain.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ protected function loadJobs(): void
5050
$this->jobs = collect();
5151
$jobPath = domain_path($this->name, 'Jobs');
5252

53-
(new Filesystem)->ensureDirectoryExists($jobPath);
53+
if (!(new Filesystem)->exists($jobPath)) return;
54+
5455
$jobFiles = (new Filesystem)->allFiles($jobPath);
5556

5657
foreach ($jobFiles as $file) {

src/Entities/Service.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ protected function loadFeatures(): void
9191
$this->features = collect();
9292
$featurePath = service_path($this->name, 'Features');
9393

94-
(new Filesystem)->ensureDirectoryExists($featurePath);
94+
if (!(new Filesystem)->exists($featurePath)) return;
95+
9596
$featureFiles = (new Filesystem)->allFiles($featurePath);
9697

9798
foreach ($featureFiles as $file) {
@@ -112,7 +113,8 @@ protected function loadControllers(): void
112113
$this->controllers = collect();
113114
$controllerPath = service_path($this->name, 'Http/Controllers');
114115

115-
(new Filesystem)->ensureDirectoryExists($controllerPath);
116+
if (!(new Filesystem)->exists($controllerPath)) return;
117+
116118
$controllerFiles = (new Filesystem)->allFiles($controllerPath);
117119

118120
foreach ($controllerFiles as $file) {

0 commit comments

Comments
 (0)