This commit is contained in:
Samuel Stancl 2020-07-26 21:46:10 +02:00 committed by GitHub
parent 141b9fdbc2
commit e130cd9596
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,8 +110,6 @@ and this on **secondary models:**
$table->unique(['post_id', 'user_id']); $table->unique(['post_id', 'user_id']);
``` ```
TODO: Unique constraints, validation, mention that eloquent models will be scoped, but DB calls won't
### Validation {#validations} ### Validation {#validations}
The `unique` and `exists` validation rules of course aren't scoped to the current tenant, so you need to scope them manually like this: The `unique` and `exists` validation rules of course aren't scoped to the current tenant, so you need to scope them manually like this:
@ -158,4 +156,4 @@ use Stancl\Tenancy\Database\Concerns\BelongsToTenant;
BelongsToTenant::$tenantIdColumn = 'team_id'; BelongsToTenant::$tenantIdColumn = 'team_id';
``` ```
Note that this is universal to all your primary models, so if you use `team_id` somewhere, you use it everywhere — you can't use both `team_id` and `tenant_id`. Note that this is universal to all your primary models, so if you use `team_id` somewhere, you use it everywhere — you can't use both `team_id` and `tenant_id`.