*/
public static function getRole($roleName)
{
- return static::where('name', '=', $roleName)->first();
+ return static::query()->where('name', '=', $roleName)->first();
}
/**
*/
public static function getSystemRole($roleName)
{
- return static::where('system_name', '=', $roleName)->first();
+ return static::query()->where('system_name', '=', $roleName)->first();
}
/**
*/
public static function visible()
{
- return static::where('hidden', '=', false)->orderBy('name')->get();
+ return static::query()->where('hidden', '=', false)->orderBy('name')->get();
+ }
+
+ /**
+ * Get the roles that can be restricted.
+ * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
+ */
+ public static function restrictable()
+ {
+ return static::query()->where('system_name', '!=', 'admin')->get();
}
}