Create model collection using factory if corresponding eloquent model has custom collection #38779
Unanswered
Tobias128128
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version: 8.45.1
PHP Version: 8.0
Database Driver & Version: MySQL
Description:
There seems to be no support to generate a collection of an eloquent model which implements a custom collection via a factory. My current workaround is to remove the implementation of the custom collection and to call it whenever it's needed. Is there another option using dedicated features of Laravel?
Steps To Reproduce:
Model definition:
Creating collection using count():
Error:
Beta Was this translation helpful? Give feedback.
All reactions