2020-05-02 14:33:41 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Traits;
|
|
|
|
|
2021-01-28 14:29:43 +03:00
|
|
|
use App\Scopes\Company;
|
|
|
|
|
2020-05-02 14:33:41 +03:00
|
|
|
trait Tenants
|
|
|
|
{
|
2021-01-28 14:29:43 +03:00
|
|
|
/**
|
|
|
|
* The "booting" method of the model.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected static function bootTenants()
|
|
|
|
{
|
|
|
|
static::addGlobalScope(new Company);
|
|
|
|
}
|
|
|
|
|
2020-05-02 14:33:41 +03:00
|
|
|
public function isTenantable()
|
|
|
|
{
|
|
|
|
return (isset($this->tenantable) && ($this->tenantable === true));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isNotTenantable()
|
|
|
|
{
|
|
|
|
return !$this->isTenantable();
|
|
|
|
}
|
|
|
|
}
|