Framework: Subdomain Routing does not resolve an implicit binding with a custom key

Created on 16 Jun 2020  路  1Comment  路  Source: laravel/framework

  • Laravel Version: 7.15.0
  • PHP Version: 7.4.6

Description:

It looks like we can't implicitly bind something with a custom key in a Route::domain and equivalent.

Steps To Reproduce:

  • Create a model, Project, with a property, domain in my case.
Route::domain('{project:domain}.app.wip')->group(function () {
    Route::get('/', function (Project $project) {
        dd($project);
    });
});

It works using only {project} but it uses the id, logic.
It works using a custom binding :

Route::bind('projectDomain', function ($domain) {
    // return the project based on the domain
});

I don't know if I missed something, or it's a bug, the documentation does not talk about this specific case (I didn't found relevant tests for this) but I might be blind.

bug

Most helpful comment

I went deep into the rabbit hole on this one but couldn't figure it out. It indeed doesn't works and I'd also expect it to should work. I can't pinpoint where the matching with the dynamic subdomain route is taking place. Gonna ping @taylorotwell to see if he knows.

>All comments

I went deep into the rabbit hole on this one but couldn't figure it out. It indeed doesn't works and I'd also expect it to should work. I can't pinpoint where the matching with the dynamic subdomain route is taking place. Gonna ping @taylorotwell to see if he knows.

Was this page helpful?
0 / 5 - 0 ratings