Sub-domain routing in Laravel

518
March 05, 2017, at 2:20 PM

I'm trying to get subdomain routing working for wildcard subdomains in Laravel 5.4. My routes look like this:

Route::group(array('domain' => '{subdomain}.example.com', 'middleware' => 'tenant'), function() {
//routes for any subdomain
});
//routes for example.com

the problem is that the subdomain is being passed to every single route. To solve this issue i added the following to my middleware:

$request->route()->forgetParameter('subdomain');

Now i got the problem that all the routes which i specified in my views are missing the subdomain parameter and i have to write every route like this:

{{ route('image.store',['subdomain' => 'currentSubdomain]) }}

what is the proper way to do subdomain routing in Laravel?

Rent Charter Buses Company
READ ALSO
php vs c++ hmac inconsistent

php vs c++ hmac inconsistent

I am trying to integrate a game engine(c++) and a server(php)

397
Programatically adding methods from an object

Programatically adding methods from an object

Say I have an object created using require('require-all')

332
How to catch 404 error in Express/Nodejs? [duplicate]

How to catch 404 error in Express/Nodejs? [duplicate]

This question already has an answer here:

456