You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
465 B
23 lines
465 B
<?php |
|
|
|
namespace App\Models; |
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
|
|
class GroupPermission extends Model |
|
{ |
|
protected $fillable = ['group_key', 'permission']; |
|
|
|
public static function permissionsForGroups(array $groups): array |
|
{ |
|
if (empty($groups)) { |
|
return []; |
|
} |
|
|
|
return self::whereIn('group_key', $groups) |
|
->pluck('permission') |
|
->unique() |
|
->values() |
|
->all(); |
|
} |
|
}
|
|
|