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

feat: Add method to check if a model has never had a specific status #127

Merged
merged 3 commits into from
May 27, 2024

Conversation

YazeedAlsaif
Copy link
Contributor

  • Added hasNeverHadStatus($name): bool method to determine if the model has never had a status with the given name.
  • Included PHPDoc comments for both hasEverHadStatus($name): bool and hasNeverHadStatus($name): bool methods.
  • Added tests for hasNeverHadStatus method:
    • Test to return false if the specific status is found.
    • Test to return true if the specific status is not found.

This contribution introduces the inverse of the hasEverHadStatus function and improves documentation.

- Added `hasNeverHadStatus($name): bool` method to determine if the model has never had a status with the given name.
- Included PHPDoc comments for both `hasEverHadStatus($name): bool` and `hasNeverHadStatus($name): bool` methods.
- Added tests for `hasNeverHadStatus` method:
  - Test to return `false` if the specific status is found.
  - Test to return `true` if the specific status is not found.

This contribution introduces the inverse of the `hasEverHadStatus` function and improves documentation.
src/HasStatuses.php Outdated Show resolved Hide resolved
- Updated `hasNeverHadStatus($name): bool` method to return the negation of `hasEverHadStatus($name)`, simplifying the logic.

This change was made following a review suggestion from @freekmurze to avoid redundant logic.
@freekmurze
Copy link
Member

Could you also add an example to the readme?

@YazeedAlsaif
Copy link
Contributor Author

Sure, done

@freekmurze freekmurze merged commit 68f594a into spatie:main May 27, 2024
4 checks passed
@freekmurze
Copy link
Member

Thank you!

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