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

Breaking Change in 2.4.0 #19

Open
kaptk2 opened this issue Jul 31, 2023 · 0 comments
Open

Breaking Change in 2.4.0 #19

kaptk2 opened this issue Jul 31, 2023 · 0 comments

Comments

@kaptk2
Copy link

kaptk2 commented Jul 31, 2023

When upgrading to version 2.4.0 my routes stopped working. I am using route model binding with ModelA and I have the following routes in web.php

Route::get('/permanent/modelA/{modelA}', function ($modelA) {
        $modelA = ModelA::findByHashId($modelA);

        if ($modelA) {
            return redirect(route('modelA.show', ['modelA' => $modelA]));
        }

        abort(404);
    })->name('modelA.permalink');

    Route::get('/modelA/{modelA:slug}', [ModelAController::class, 'show'])->name('modelA.show');

The idea being that the slug might change but I would always be able to use the hash id to find the model. This behavior no longer works with version 2.4.0. The easiest work around is to use explicit model binding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant