|
12 | 12 | use DragonCode\LaravelActions\Repositories\ActionRepository;
|
13 | 13 | use DragonCode\LaravelActions\Services\Migrator;
|
14 | 14 | use DragonCode\LaravelActions\Values\Options;
|
| 15 | +use DragonCode\Support\Facades\Helpers\Arr; |
15 | 16 | use DragonCode\Support\Facades\Helpers\Str;
|
16 | 17 | use DragonCode\Support\Filesystem\File;
|
| 18 | +use DragonCode\Support\Helpers\Ables\Arrayable; |
17 | 19 | use Illuminate\Console\OutputStyle;
|
18 | 20 | use Illuminate\Contracts\Events\Dispatcher;
|
19 | 21 | use Symfony\Component\Console\Input\InputInterface;
|
@@ -41,11 +43,17 @@ public function __construct(
|
41 | 43 | $this->migrator->setConnection($this->options->connection)->setOutput($this->output);
|
42 | 44 | }
|
43 | 45 |
|
44 |
| - protected function getFiles(?Closure $filter = null, ?string $path = null, bool $realpath = false): array |
| 46 | + protected function getFiles(?Closure $filter = null, ?string $path = null, bool $realpath = false, bool $fullpath = false): array |
45 | 47 | {
|
46 | 48 | $path = $this->getActionsPath($path, $realpath);
|
47 | 49 |
|
48 |
| - return $this->file->exists($path) ? [$path] : $this->file->names($path, $filter, true); |
| 50 | + $names = $this->file->exists($path) ? [$path] : $this->file->allPaths($path, $filter, true); |
| 51 | + |
| 52 | + return Arr::of($names) |
| 53 | + ->when(! $fullpath, fn (Arrayable $array) => $array |
| 54 | + ->map(fn (string $value) => Str::of(realpath($value))->after(realpath($path))->ltrim('\\/')->toString()) |
| 55 | + ) |
| 56 | + ->toArray(); |
49 | 57 | }
|
50 | 58 |
|
51 | 59 | protected function getActionsPath(?string $path = null, bool $realpath = false): string
|
|
0 commit comments