You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, congratulations on the 1.0-alpha release! This project shows a lot of potential, and I truly appreciate the effort you’ve put into it.
I’ve been experimenting with it and encountered an error I can’t seem to resolve. I’ve installed the package and configured it for subdomain tenancy with an Eloquent model. Here’s my multitenancy.php configuration file:
<?phpuseSprout\TenancyOptions;
return [
/* |-------------------------------------------------------------------------- | Multitenancy Defaults |-------------------------------------------------------------------------- | | This option defines the default tenancy, tenant provider and identity | resolver for your application. | You may change these values as required, but they're a perfect start | for most applications. | */'defaults' => [
'tenancy' => 'tenants',
'provider' => 'tenants',
'resolver' => 'subdomain',
],
/* |-------------------------------------------------------------------------- | Tenancies |-------------------------------------------------------------------------- | | Next, you may define every tenancy type for your application. | If you only have one type of tenancy within your application, which will | be the case for most people, you can leave it at one. | | All tenancies have a tenant provider, which defines how the | tenants are actually retrieved out of your database or other storage | system used by the application. | | Tenancies can also have options, which is an array of options provided | by the TenancyOptions class that lets you fine tune the tenancies | behaviour. | */'tenancies' => [
'tenants' => [
'provider' => 'tenants',
'options' => [
TenancyOptions::hydrateTenantRelation(),
TenancyOptions::throwIfNotRelated(),
],
],
],
/* |-------------------------------------------------------------------------- | Tenant Providers |-------------------------------------------------------------------------- | | All tenancies have a tenant provider, which defines how the | tenants are actually retrieved out of your database or other storage | system used by the application. | | If you have multiple tenant tables or models, you can configure multiple | providers to represent each. | These providers may then be assigned to any extra tenancies you have defined. | | Supported: "database", "eloquent" | */'providers' => [
'tenants' => [
'driver' => 'eloquent',
'model' => \App\Models\TenantModel::class,
],
// 'backup' => [// 'driver' => 'database',// 'table' => 'tenants',// ],
],
/* |-------------------------------------------------------------------------- | Identity Resolvers |-------------------------------------------------------------------------- | | Where Laravel's auth would have a separate guard for each way that a | user can be authenticated in a request (think session, header, etc.), | Sprout abstracts this out into identity resolvers. | This means that all tenancies within the application can use all | configured resolvers. | | If you have multiple ways that tenant can be identified, say, through | subdomain and then a HTTP header for APIs, you can define one for each. | | There are sensible defaults for each supported driver, though it is | recommended that you remove any that you don't need, for simplicity | sake. | | Supported: "subdomain", "header", "path", "cookie" and "session" | */'resolvers' => [
'subdomain' => [
'driver' => 'subdomain',
'domain' => 'tenancy.test',
'pattern' => '.*',
],
],
];
Then when I try to access let's say, example.tenancy.test/login I get this error, I've traced and it's being raised by the createEloquentProvider function. The db has a record with the tenant, and I've also tried to add the getTenantKeyName and the getTenantIdentifierName but doesn't work, probably because I'm doing something wrong.
Sprout\Exceptions\MisconfigurationException
The provided value for 'model' is not valid forprovider [tenants]
Appreciate if you can give me a hand here to keep playing with it, thanks!
The text was updated successfully, but these errors were encountered:
First of all, congratulations on the 1.0-alpha release! This project shows a lot of potential, and I truly appreciate the effort you’ve put into it.
I’ve been experimenting with it and encountered an error I can’t seem to resolve. I’ve installed the package and configured it for subdomain tenancy with an Eloquent model. Here’s my
multitenancy.php
configuration file:My tenant model looks like this:
Then, I've set up the route like this:
Then when I try to access let's say, example.tenancy.test/login I get this error, I've traced and it's being raised by the
createEloquentProvider
function. The db has a record with the tenant, and I've also tried to add thegetTenantKeyName
and thegetTenantIdentifierName
but doesn't work, probably because I'm doing something wrong.Appreciate if you can give me a hand here to keep playing with it, thanks!
The text was updated successfully, but these errors were encountered: