Skip to content

Using a custom collection for a model #17

@mikemand

Description

@mikemand

Hello,

I have a model that I use a custom collection with, to do some aggregations and such. Currently, I have to set my return typehint to \Illuminate\Database\Eloquent\Collection instead of my custom collection, because of:

public function newCollection(array $models = []): Collection

Not a deal-breaker, as I can use the phpdoc to tell my IDE what the real return type is. However, with me overwriting the newCollection method, what does that do to autoloading for this model? As far as I can tell, the only important line is 145, but I don't know what it does exactly...

Are there some side-effects I am not aware of with using my own custom collection with your package?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions