Skip to content

[Single DB] The request expected a current tenant but none was set. #618

@leo-lizi

Description

@leo-lizi

Hello, I am having difficulty understanding how the package works following the documentation.
I'm following all the steps and still, I'm getting errors and the app works strangely.

If I set the landLord route at the beginning, I am warned of the error "The request expected a current tenant but none was set.", but the tenant domain works correctly (displays the tenant information).

If I reverse this order (tenant -> landlord), tenants and landlord displays the contents of landLord.

`Route::get('/', function () {
return "Hello Landlord!";
});

Route::middleware('tenant')->name('tenant.')->group(function() {
Route::get('/', function () {
return "Tenant by tenant.php: " . app('currentTenant');
});
});

Auth::routes();`

I will attach the main files that I changed.

Another thing, I extended the Tenant modal, is the database field really mandatory to fill in? Even though it is a single database.

Thank u!

Tenant.php

multitenancy.php

app.php

web.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions