mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:54:05 +00:00
remove HasDataColumn trait
This commit is contained in:
parent
8c34640948
commit
648acc48c7
2 changed files with 9 additions and 20 deletions
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Stancl\Tenancy\Database\Concerns;
|
|
||||||
|
|
||||||
use Stancl\VirtualColumn\VirtualColumn;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extends VirtualColumn for backwards compatibility. This trait will be removed in v4.
|
|
||||||
*/
|
|
||||||
trait HasDataColumn
|
|
||||||
{
|
|
||||||
use VirtualColumn;
|
|
||||||
}
|
|
||||||
|
|
@ -11,6 +11,7 @@ use Stancl\Tenancy\Database\Concerns;
|
||||||
use Stancl\Tenancy\Database\TenantCollection;
|
use Stancl\Tenancy\Database\TenantCollection;
|
||||||
use Stancl\Tenancy\Events;
|
use Stancl\Tenancy\Events;
|
||||||
use Stancl\Tenancy\Exceptions\TenancyNotInitializedException;
|
use Stancl\Tenancy\Exceptions\TenancyNotInitializedException;
|
||||||
|
use Stancl\VirtualColumn\VirtualColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property string|int $id
|
* @property string|int $id
|
||||||
|
|
@ -22,18 +23,16 @@ use Stancl\Tenancy\Exceptions\TenancyNotInitializedException;
|
||||||
*/
|
*/
|
||||||
class Tenant extends Model implements Contracts\Tenant
|
class Tenant extends Model implements Contracts\Tenant
|
||||||
{
|
{
|
||||||
use Concerns\CentralConnection,
|
use VirtualColumn,
|
||||||
|
Concerns\CentralConnection,
|
||||||
Concerns\GeneratesIds,
|
Concerns\GeneratesIds,
|
||||||
Concerns\HasDataColumn,
|
|
||||||
Concerns\HasInternalKeys,
|
Concerns\HasInternalKeys,
|
||||||
Concerns\TenantRun,
|
Concerns\TenantRun,
|
||||||
Concerns\InitializationHelpers,
|
Concerns\InitializationHelpers,
|
||||||
Concerns\InvalidatesResolverCache;
|
Concerns\InvalidatesResolverCache;
|
||||||
|
|
||||||
protected $table = 'tenants';
|
protected $table = 'tenants';
|
||||||
|
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
public function getTenantKeyName(): string
|
public function getTenantKeyName(): string
|
||||||
|
|
@ -46,12 +45,17 @@ class Tenant extends Model implements Contracts\Tenant
|
||||||
return $this->getAttribute($this->getTenantKeyName());
|
return $this->getAttribute($this->getTenantKeyName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the current tenant. */
|
||||||
public static function current(): static|null
|
public static function current(): static|null
|
||||||
{
|
{
|
||||||
return tenant();
|
return tenant();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @throws TenancyNotInitializedException */
|
/**
|
||||||
|
* Get the current tenant or throw an exception if tenancy is not initialized.
|
||||||
|
*
|
||||||
|
* @throws TenancyNotInitializedException
|
||||||
|
*/
|
||||||
public static function currentOrFail(): static
|
public static function currentOrFail(): static
|
||||||
{
|
{
|
||||||
return static::current() ?? throw new TenancyNotInitializedException;
|
return static::current() ?? throw new TenancyNotInitializedException;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue