mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:24:03 +00:00
21 lines
547 B
PHP
21 lines
547 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Stancl\Tenancy\Database\Concerns;
|
|
|
|
use Illuminate\Validation\Rules\Exists;
|
|
use Illuminate\Validation\Rules\Unique;
|
|
|
|
trait HasScopedValidationRules
|
|
{
|
|
public function unique($table, $column = 'NULL')
|
|
{
|
|
return (new Unique($table, $column))->where(BelongsToTenant::tenantIdColumn(), $this->getTenantKey());
|
|
}
|
|
|
|
public function exists($table, $column = 'NULL')
|
|
{
|
|
return (new Exists($table, $column))->where(BelongsToTenant::tenantIdColumn(), $this->getTenantKey());
|
|
}
|
|
}
|