motomedialab / laravel-self-healing-urls

Never worry about slugs again - generate self-healing URLs for your Laravel Project
MIT License
25 stars 3 forks source link

Disable Self Healing Urls on some routes. #1

Closed mrkatz closed 5 days ago

mrkatz commented 6 days ago

I may have something wrong, but I believe that all routes referencing the model we have enabled Self Healing URLs are forced to bind via the full slug. So Route::get('/product/{product:id}/edit', [ProductController::class, 'edit'])->name('product.edit')->can('admin'); Will no longer override this behavior. Is it possible to override depending on route?

chrispage1 commented 5 days ago

Morning!

Thanks and good point. I've run into this myself and wrote a manual override. In my case it was loading them inside the admin.

I'll add some middleware today that'll temporarily disable the self healing URL behaviour 👍🏻

chrispage1 commented 5 days ago

I've added some additional tests and Motomedialab\LaravelSelfHealingUrls\Middleware\DisableSelfHealingUrls::class middleware. Its important to note this will need to be called before the web middleware initialisation 👍

chrispage1 commented 5 days ago

PR #2 also :)

mrkatz commented 5 days ago

Nice work thank you. Much simpler solution then what I had been working on.

On Fri, 18 Oct 2024, 3:32 am Chris Page, @.***> wrote:

PR #2 https://github.com/motomedialab/laravel-self-healing-urls/pull/2 also :)

— Reply to this email directly, view it on GitHub https://github.com/motomedialab/laravel-self-healing-urls/issues/1#issuecomment-2420003264, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC4MUSNBFCQFB5P33WS6V3LZ37RAZAVCNFSM6AAAAABQCMFUOWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRQGAYDGMRWGQ . You are receiving this because you authored the thread.Message ID: @.***>