added ownership
This commit is contained in:
18
app/Traits/Owners.php
Normal file
18
app/Traits/Owners.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
trait Owners
|
||||
{
|
||||
public function isOwnable()
|
||||
{
|
||||
$ownable = $this->ownable ?: true;
|
||||
|
||||
return ($ownable === true) && in_array('created_by', $this->getFillable());
|
||||
}
|
||||
|
||||
public function isNotOwnable()
|
||||
{
|
||||
return !$this->isOwnable();
|
||||
}
|
||||
}
|
@ -18,7 +18,9 @@ trait Tenants
|
||||
|
||||
public function isTenantable()
|
||||
{
|
||||
return (isset($this->tenantable) && ($this->tenantable === true));
|
||||
$tenantable = $this->tenantable ?: true;
|
||||
|
||||
return ($tenantable === true) && in_array('company_id', $this->getFillable());
|
||||
}
|
||||
|
||||
public function isNotTenantable()
|
||||
|
Reference in New Issue
Block a user