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

How to define a catch-all route

Open hardikdangar opened this issue 3 years ago • 2 comments

I have pages as my model. and i am binding it via,

Orion::resource('pages', PageController::class)->where(['page', '([0-9A-Za-z/\s-]*)'])->only(['index', 'show']);

above does work for single routes like /api/pages/about

but it doesn't work for nested routes. /api/pages/about/faq

I know laravel has any route so i can do it that way but orion doesn't have that. i even tried, Orion::resource('pages/about', PageController::class)->only(['show']); but this tries to find faq model so not sure how i can achieve that with orion. tried going through docs but nothing on documentation as well.

hardikdangar avatar Aug 31 '22 11:08 hardikdangar

@GautierDele can you help me with this

hardikdangar avatar Sep 08 '22 20:09 hardikdangar

Hi @hardikdangar,

Might be a typo in your regex - escape the \ character: ([0-9A-Za-z\/\s-]*)

https://regex101.com/r/lxLz6P/1

Screen Shot 2022-09-09 at 10 39 56

Screen Shot 2022-09-09 at 10 39 13

alexzarbn avatar Sep 09 '22 05:09 alexzarbn