1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 21:54:03 +00:00

Add methods to Tenant contract

This commit is contained in:
Samuel Štancl 2020-05-10 20:20:44 +02:00
parent 494d274798
commit 2492345280
3 changed files with 18 additions and 7 deletions

View file

@ -7,7 +7,6 @@ use Stancl\Tenancy\DatabaseConfig;
use Stancl\Tenancy\Events;
use Stancl\Tenancy\Contracts;
// todo use a contract
// todo @property
class Tenant extends Model implements Contracts\Tenant
{
@ -16,6 +15,17 @@ class Tenant extends Model implements Contracts\Tenant
}
public $primaryKey = 'id';
public $guarded = [];
public function getTenantKeyName(): string
{
return 'id';
}
public function getTenantKey(): string
{
return $this->getAttribute($this->getTenantKeyName());
}
public function getCasts()
{
@ -29,8 +39,6 @@ class Tenant extends Model implements Contracts\Tenant
return config('tenancy.id_generator') === null;
}
public $guarded = [];
public static function internalPrefix(): string
{
return config('tenancy.database_prefix');