Skip to content

Commit

Permalink
Update for Laravel 7
Browse files Browse the repository at this point in the history
  • Loading branch information
judgej committed Jun 1, 2020
1 parent adadb85 commit 59111e6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ $ php artisan storage:ls --disk=s3
# or

$ php artisan storage:ls -d s3

# or

$ php artisan storage:ls s3:
```

```bash
Expand All @@ -69,6 +73,10 @@ d 0 2019-08-21 11:19:46 public

```bash
$ php artisan storage:ls -d s3 my-folder/sub-folder

// or separate the disk and directory with a colon

$ php artisan storage:ls s3:my-folder/sub-folder
```

## List files and directories recursively
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"minimum-stability": "dev",
"require": {
"illuminate/support": "~5.6|^6.0",
"illuminate/support": "~5.6|^6.0|^7.0",
"php": "^7.0"
},
"require-dev": {
Expand Down
14 changes: 13 additions & 1 deletion src/Console/Commands/ListStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,22 @@ public function handle()
return 1;
}

$selectedDir = $this->argument('directory') ?? '/';

$selectedDisk = $this->option('disk') ?? '';
$defaultDisk = config('filesystems.default');

if ($selectedDisk === '' && strpos($selectedDir, ':') !== false) {
// User may be using the "disk:directory" format.

[$diskSplit, $dirSplit] = explode(':', $selectedDir);

if (array_key_exists($diskSplit, $disks)) {
$selectedDisk = $diskSplit;
$selectedDir = $dirSplit;
}
}

if ($selectedDisk !== '' && ! array_key_exists($selectedDisk, $disks)) {
$this->error(sprintf('Selected disk "%s" does not exist', $selectedDisk));
$selectedDisk = '';
Expand All @@ -68,7 +81,6 @@ public function handle()
return;
}

$selectedDir = $this->argument('directory') ?? '/';
$recursive = $this->option('recursive');
$longFormat = $this->option('long');

Expand Down

0 comments on commit 59111e6

Please sign in to comment.