happypixels / laravel-shopr

A developer-friendly e-commerce foundation for your Laravel app
https://laravel-shopr.happypixels.se
MIT License
208 stars 19 forks source link

Allows to configure routes #32

Open jenky opened 5 years ago

jenky commented 5 years ago

Is your feature request related to a problem? Please describe. The route paths and middleware can't be configured atm.

Describe the solution you'd like Update config to support route path and middleware similar to laravel/telescope

mattias-persson commented 5 years ago

Thanks for your request! Could you please provide a bit more detail on how you'd like it to work? Is it the API route prefix you'd like to change or the other routes?

jenky commented 5 years ago

I want to change the both route prefix and paths, apply my middleware. And also, I want to add my own logic since I dont want to use fully qualified class name for shoppable_type in order_items table so I'm using morphMap to customize polymorphic types, transform data to my desire response format. Ideally, I think you shouldn't register routes automatically. You could use the route macro to add your method i.e Route::cart() similar to Route::auth() from Laravel so developers can decide whether the route should be registered.

mattias-persson commented 5 years ago

Right. I'll make the middleware and prefixes + paths configurable in the next release.

I'm currently working on a public API for managing the cart without using the REST API, when that's done I was planning on making the REST API optional. Is that what you meant?

jenky commented 5 years ago

Yes, please. Giving developers more power to do whatever they want