added ownership

This commit is contained in:
Denis Duliçi
2021-06-17 10:59:07 +03:00
parent de0d26b803
commit a3572de1ec
54 changed files with 253 additions and 37 deletions

18
app/Traits/Owners.php Normal file
View 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();
}
}

View File

@ -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()