Open tabacitu opened 1 year ago
@pxpm let me know what you think about this idea, if it has any merit in your eyes... if it's worth doing. Feel like a good change from OUR perspective (maintainers), but a pretty selfish one because it doesn't really bring any benefit to the developer. Well I guess:
PROs:
CONs:
CrudTrait
(or CrudModel
in this case);Holy fucking shit. I've just discovered mixins are a thing 🤯 https://liamhammett.com/laravel-mixins-KEzjmLrx
We could go that route too.
Feature Request
What's the feature you think Backpack should have?
Do we really need the CrudTrait to be added to a Model, in order to work with it? It's one extra step when creating an admin panel... and I don't really like it. It feel like you're bloating up your model. And the stuff it adds... isn't exactly stuff that should be on the Model anyway:
It's admin panel stuff, not Model stuff.
Have you already implemented a prototype solution, for your own project?
No, but I've just thought of a way to possibly eliminate it. What I don't know is... how much of a breaking change this would be. But if I'm right... it could even be a non-breaking change... 🤯 Or close to it.
What if when we do
that method doesn't just do
but instead... passed that model... to passthrough Model? So we'd have something like:
Hmm... then all the methods in those traits would need to call
$this->model
instead of$this
orself
orstatic
. So I guess it would be a breaking change... But... maybe it's worth it?What would the upgrade guide say? Probably:
$this->methodName()
please do(new CrudModel(self))->methodName()
; here's a list of all methods in that trait; please note that if you're usinguploadFileToDisk()
oruploadMultipleFilesToDisk()
... we have a better way to do that now, see X;Do you see this as a core feature or an add-on?
Core but it's a SHOULD/COULD.