Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Add a more readable "missing" method to Filesystem and FilesystemAdapter #30441

Merged
merged 4 commits into from
Oct 27, 2019

Conversation

AmirrezaNasiri
Copy link
Contributor

This PR adds a new missing() method to both Illuminate\Filesystem\Filesystem and of course Illuminate\Filesystem\FilesystemAdapter so we can check missing files or directories in a more readable way.

In other word, instead of following condition checkings:

if (!Storage::exists('file.txt')) {
   // ...
}

if (!File::exists('file.txt')) {
   // ...
}

We can do:

if (Storage::missing('file.txt')) {
   // ...
}

if (File::missing('file.txt')) {
   // ...
}

There is no much logic behind the methods and I think they don't add maintenance overload.

@taylorotwell taylorotwell merged commit 69f9fa4 into laravel:6.x Oct 27, 2019
baijunyao added a commit to baijunyao/laravel-bjyblog that referenced this pull request Nov 4, 2019
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.

2 participants