laravel-shopr icon indicating copy to clipboard operation
laravel-shopr copied to clipboard

Allows to configure routes

Open jenky opened this issue 6 years ago • 4 comments

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

jenky avatar Aug 09 '19 07:08 jenky

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?

mattias-persson avatar Aug 09 '19 08:08 mattias-persson

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.

jenky avatar Aug 09 '19 11:08 jenky

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?

mattias-persson avatar Aug 09 '19 13:08 mattias-persson

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

jenky avatar Aug 09 '19 13:08 jenky