-
Notifications
You must be signed in to change notification settings - Fork 583
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
[3.x] Models\Feature::scopeForBucket() return type of Builder doesn't match returned collection #2154
Comments
Merged
Hey @markcameron, I have proposed to use the scope as scope and add a helper in #2161. @ifox ok like this? |
Hey @haringsrob Thanks for the PR, fixes the issue on my end. Guess we just need to wait to get it merged into the |
Thanks for confirming. Will be in the next release. |
zeezo887
pushed a commit
to zeezo887/twill
that referenced
this issue
Apr 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I am upgrading a project from
2.x
to3.x
When using feature buckets to organize content, and then calling
\A17\Twill\Models\Feature::forBucket('bucket-name')
on the frontend, it throws the following error:This appears to be because the
scopeForBucket()
method is now typed, and the code within probably does too much for a Laravel Scope method, since it does a->get()
and then does some post processing on the query result.Steps to reproduce
Follow the steps from the documentation to create Featured Content and then in the front end of your application, render the contents of a bucket using
$content = \A17\Twill\Models\Feature::forBucket('bucket-name')
Expected result
A Collection of Models that are stored in the Bucket
Actual result
Throws
Versions
Twill version:
3.0.0-rc4
Laravel version:
9.52.0
PHP version:
8.2.2
Database engine:
mariadb-10
Note
I'm not sure what would be actual end result should be. It's programmed as a
scope
, so should return a builder and allow it to be chained with more query arguments. So maybe it should just be converted to a simple method on the Eloquent Model so that you can return the processed CollectionThe text was updated successfully, but these errors were encountered: