Skip to content
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

CLI to extend the package #18

Closed
tabacitu opened this issue Nov 7, 2016 · 2 comments
Closed

CLI to extend the package #18

tabacitu opened this issue Nov 7, 2016 · 2 comments

Comments

@tabacitu
Copy link
Member

tabacitu commented Nov 7, 2016

It would:

  1. create model that extends the one from vendor
  2. create crudcontroller that extends the one from vendor
  3. create request that extends the one from vendor
  4. inform the developer to copy-paste some routes in his route file

This would make it much easier to overwrite the default functionality.

What would make it ever easier would be for this to be done by default, during the installation process. But it would take another 2 steps, and that's a lot. We could do this for all packages, after we build the installer. And then:

  • modifying some Backpack behaviour would be so much easier;
  • you'd have the appropriate files (controllers, models, routes) insinde your app, so you understand how it works a lot easier;
@tricki
Copy link

tricki commented Dec 25, 2016

I've been thinking about this because I need to modify the Page model.

I'm wondering if all of this is necessary. Why should the model, controller and request be created if I only want to modify the model (or nothing at all if it creates them by default)?
I would prefer a more general way to allow a user to extend any Backpack package and add only the files that are needed.
I'm not an expert in Laravel package development but I think this could be done by resolving the relevant classes using the IoC container although I'm not sure how to best integrate this into the CRUD package (specifically CrudPanel::setModel()).

As for the routes: I think a good way (for this and other Backpack packages) would be to use the normal CRUD::resource() method, so the process would be the same as when creating a custom CRUD interface. The problem with this is that the PageManager routes include the template name in the URL. IMHO this could be moved to a POST parameter. We could then still define the default template in a URL by adding ?template=TEMPLATE.

All this would result in some more work when installing the package (adding the routes) and when you want to modify the classes but I think it would be better especially as a default for future Backpack packages.

@unstoppablecarl
Copy link
Contributor

It doesn't need all this, it just needs a config file that lets you set the model/ controller, and a more easily extended service provider.

@tabacitu tabacitu closed this as completed Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants