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

How can i organise web.php routs and judge which tenant in controller for url 'boise.townhouse.dev/show' #13

Open
singler009 opened this issue May 7, 2018 · 3 comments

Comments

@singler009
Copy link

Hello, How can i organise web.php routs and judge which tenant in controller for url 'boise.townhouse.dev/show'.
I have no idea to handle Hyn\Tenancy!

thank you!

@singler009
Copy link
Author

And where can i find tenant`s config of db connection ?

@luceos
Copy link

luceos commented Jun 12, 2018

@singler009 tenant configuration for the database are created on the fly.

@colinmackinlay
Copy link
Contributor

In RouteServiceProvider.php

public function map(Router $router)
    {
.....
        **$this->mapTenantRoutes($router);**
.....
    }

    protected function mapTenantRoutes(Router $router)
    {
        $router->middleware(['web', 'tenancy.enforce'])
            ->domain('{account}.yourapphostname')
            ->namespace($this->namespace)
            ->as('tenant.')
            ->group(base_path('routes/tenant/mytenantroutes.php'));
}

In mytenantroutes.php:

use Illuminate\Support\Facades\Route;

Route::group(['prefix' => 'profile'], function () {
    Route::get('/', 'MyControllerController@action')->name('controller.action'); 
});

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

3 participants