spatie / laravel-query-builder

Easily build Eloquent queries from API requests

Home Page:https://spatie.be/docs/laravel-query-builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create from mixes static and self

olliescase opened this issue · comments

return static::createFrom($request, new self());

Is there a reason why the fromRequest method creates a new instance of self() rather than static() this means if you extend the class you have to then also override this function in order for it to return the extended class.

There may well be a "best practice" or use-case for this behaviour I'm not thinking of, but thought I'd question it as it struck me a little odd :)

Hey @olliescase, you're right, this is probably an oversight. Feel free to PR the change from new self() to new static() and I'll merge it in :)

Thanks!