Skip to content

[9.x] Adds isDirectoryEmpty() and isDirectoryNotEmpty() to Filesystem - #42559

Merged
taylorotwell merged 9 commits into
laravel:9.xfrom
DarkGhostHunter:feat/file-dir-empty
May 31, 2022
Merged

taylorotwell merged 9 commits into
laravel:9.xfrom
DarkGhostHunter:feat/file-dir-empty

Conversation

@DarkGhostHunter

@DarkGhostHunter DarkGhostHunter commented May 29, 2022

Copy link
Copy Markdown
Contributor

What?

Allows to check if a directory has files/directories or not. Even hidden ones.

use Illuminate\Support\Facades\File;

if (File::isDirectoryEmpty('john/photos')) {
    return 'You do not have any photos';
}

if (File::isDirectoryNotEmpty('john/videos', true)) {
    return 'You may have one or more videos, even hidden ones.';
}

BC?

Nope, just adding methods.

@DarkGhostHunter DarkGhostHunter changed the title [9.x] Adds hasFiles() and hasNoFiles() to Filesystem [9.x] Adds isDirectoryEmpty() and isDirectoryNotEmpty() to Filesystem May 30, 2022
@johanrosenson

Copy link
Copy Markdown
Contributor

Your examples are confusing, your returned strings doesn't match what you expect should happen.

@DarkGhostHunter
DarkGhostHunter marked this pull request as draft May 30, 2022 04:36
Comment thread src/Illuminate/Filesystem/Filesystem.php Outdated
@DarkGhostHunter

Copy link
Copy Markdown
Contributor Author

Your examples are confusing, your returned strings doesn't match what you expect should happen.

Fixed.

@DarkGhostHunter
DarkGhostHunter marked this pull request as ready for review May 30, 2022 17:47
@taylorotwell
taylorotwell merged commit 77ceefe into laravel:9.x May 31, 2022
@DarkGhostHunter
DarkGhostHunter deleted the feat/file-dir-empty branch September 8, 2022 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants