added tenantable attribute to models
This commit is contained in:
@ -13,6 +13,8 @@ class Permission extends LaratrustPermission
|
||||
|
||||
protected $table = 'permissions';
|
||||
|
||||
protected $tenantable = false;
|
||||
|
||||
/**
|
||||
* The accessors to append to the model's array form.
|
||||
*
|
||||
|
@ -13,6 +13,8 @@ class Role extends LaratrustRole
|
||||
|
||||
protected $table = 'roles';
|
||||
|
||||
protected $tenantable = false;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
|
@ -19,6 +19,8 @@ class User extends Authenticatable
|
||||
|
||||
protected $table = 'users';
|
||||
|
||||
protected $tenantable = false;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
|
@ -14,6 +14,8 @@ class Company extends Eloquent
|
||||
|
||||
protected $table = 'companies';
|
||||
|
||||
protected $tenantable = false;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
protected $fillable = ['domain', 'enabled'];
|
||||
|
@ -9,5 +9,7 @@ class Media extends BaseMedia
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $tenantable = false;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
}
|
||||
|
@ -3,10 +3,13 @@
|
||||
namespace App\Models\Setting;
|
||||
|
||||
use App\Scopes\Company;
|
||||
use App\Traits\Tenants;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class Setting extends Eloquent
|
||||
{
|
||||
use Tenants;
|
||||
|
||||
protected $table = 'settings';
|
||||
|
||||
public $timestamps = false;
|
||||
@ -55,4 +58,14 @@ class Setting extends Eloquent
|
||||
{
|
||||
return $query->where($this->table . '.company_id', '=', $company_id);
|
||||
}
|
||||
|
||||
public function isTenantable()
|
||||
{
|
||||
return (isset($this->tenantable) && ($this->tenantable === true));
|
||||
}
|
||||
|
||||
public function isNotTenantable()
|
||||
{
|
||||
return !$this->isTenantable();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user