mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 02:04:03 +00:00
Refactor models & config
This commit is contained in:
parent
f0ff8248e7
commit
2839f45196
9 changed files with 123 additions and 97 deletions
32
src/Database/Concerns/HasInternalKeys.php
Normal file
32
src/Database/Concerns/HasInternalKeys.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Database\Concerns;
|
||||
|
||||
trait HasInternalKeys
|
||||
{
|
||||
/**
|
||||
* Get the internal prefix.
|
||||
*/
|
||||
public static function internalPrefix(): string
|
||||
{
|
||||
return 'tenancy_';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an internal key.
|
||||
*/
|
||||
public function getInternal(string $key)
|
||||
{
|
||||
return $this->getAttribute(static::internalPrefix() . $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set internal key.
|
||||
*/
|
||||
public function setInternal(string $key, $value)
|
||||
{
|
||||
$this->setAttribute(static::internalPrefix() . $key, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue