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

Add model and user to all event constructors #49

Merged
merged 7 commits into from
Feb 17, 2024

Conversation

nunodonato
Copy link
Contributor

Small change to let all events receive the model and the authenticated user that triggered it.

On second thought, I think it might be more beneficial to change the constructor parameters to receive the Approval model itself, instead of the eloquent model that was changed. This is because from the Approval we can easily get to the subject, while the opposite might not be true (when a model has multiple Approvals).
What do you think @cjmellor ?

@cjmellor
Copy link
Owner

Will have a proper look when I finish my day job 😅

Thanks for contributing!

@cjmellor
Copy link
Owner

Can you add some tests? I'd feel more at ease if I know it is returning exactly what is expected.

# Conflicts:
#	src/Scopes/ApprovalStateScope.php
In this commit, an unnecessary space was removed in MustBeApproved.php file to make the code cleaner. In addition, the migration file's structure was slightly adjusted for better readability. Tests were also modified to increase test coverage and improve its quality, especially in the handling of 'fake_users'.
In this commit, we've updated the matched cases of ApprovalStatus in ApprovalStateScope.php. Rather than using a $model, we've changed to using $builder->getModel() in Dispatch Events to improve consistency and clarity of the code.
In this commit, Schema import has been added to the ApprovalStateScopeTest. This extra import is necessary for the functioning of our DB tests and ensures that the test for Approval Model states runs smoothly.
@cjmellor cjmellor merged commit b484979 into cjmellor:main Feb 17, 2024
5 checks passed
@cjmellor
Copy link
Owner

Thanks @nunodonato

I ended up wanting this so just made sure the tests pass myself.

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.

None yet

2 participants