chore
This commit is contained in:
@@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||
namespace Modules\Permissions\Models;
|
||||
|
||||
use Catch\Base\CatchModel as Model;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Modules\Permissions\Models\Traits\DataRange;
|
||||
|
||||
/**
|
||||
* @property $role_name
|
||||
@@ -21,8 +21,6 @@ use Modules\Permissions\Models\Traits\DataRange;
|
||||
*/
|
||||
class Roles extends Model
|
||||
{
|
||||
use DataRange;
|
||||
|
||||
protected $table = 'roles';
|
||||
|
||||
protected $fillable = ['id', 'role_name', 'identify', 'parent_id', 'description', 'data_range', 'creator_id', 'created_at', 'updated_at', 'deleted_at'];
|
||||
@@ -75,4 +73,22 @@ class Roles extends Model
|
||||
{
|
||||
return $this->belongsToMany(Departments::class, 'role_has_departments', 'role_id', 'department_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* get role's permissions
|
||||
* @return Collection
|
||||
*/
|
||||
public function getPermissions(): Collection
|
||||
{
|
||||
return $this->permissions()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* get role's departments
|
||||
* @return Collection
|
||||
*/
|
||||
public function getDepartments(): Collection
|
||||
{
|
||||
return $this->departments()->get();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user