-
-
Notifications
You must be signed in to change notification settings - Fork 321
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 withCount support #920
base: master
Are you sure you want to change the base?
Add withCount support #920
Conversation
Hi @shalvah, I am finalizing the PR and want to add some test coverage, but it actually requires adding a database to test the "withCount" feature. Additionally, I don't see any tests related to the "with" feature, likely because it also requires a database, which might be why it's missing. Any thouths/suggestions around this? thanks |
There are some tests that do use a database (SQLite in memory). We even have migrations. Example: scribe/tests/Unit/ValidationRuleParsingTest.php Lines 45 to 47 in 4d4a44e
You can follow the example. |
@shalvah, thanks. I missed that. The PR is ready; please take a look whenever you have time. |
Is the scribe/tests/Strategies/GetFromInlineValidatorTest.php Lines 235 to 237 in 46e8399
|
@shalvah fixed! The "whenCounted" method was introduced in Laravel v9. See: laravel/framework#43101 PS: added a few more checks |
Remove extra line
withCount
inResponseFromApiResource
#620whenCounted
to JsonResource laravel/framework#43101This PR adds withCount to the ResponseFromApiResource and will be supported by the factoryCreate model source