Reputation: 31
I'm developping a SaaS application for real estate agents where they can add houses / appartements and list them in a public view / url. They can also add their own domain / sub-domain in order to have custom public URLs. The thing is, since I add the alias related to the domain the user added, all the app is accessible with this new url. What I'd like to do is only allowing the public routes of the properties concerned by the user and prevent the other URLs.
A property has a user_id as well as a domain_id
Regards
Upvotes: 0
Views: 2340
Reputation: 330
Laravel has subdomain routing. It should allow you to capture the subdomain ($account
in the example) if you want to use it later or only add the relevant routes inside the route file.
Route::domain('{account}.myapp.com')->group(function () {
Route::get('user/{id}', function ($account, $id) {
//
});
});
Upvotes: 2