Preserva entrega A aceite de servicos em rascunho
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Services;
|
||||
|
||||
final class ServicePermissions
|
||||
{
|
||||
public const AREAS = ['clients', 'services', 'service_drafts', 'billing_drafts'];
|
||||
public const ACTIONS = ['view', 'create', 'edit', 'manage'];
|
||||
public const LABELS = ['clients' => 'Clientes', 'services' => 'Serviços', 'service_drafts' => 'Prestações em rascunho', 'billing_drafts' => 'Rascunhos de facturação'];
|
||||
|
||||
public static function unitScoped(string $area): bool { return in_array($area, ['service_drafts', 'billing_drafts'], true); }
|
||||
public static function catalogue(bool $unit): array
|
||||
{
|
||||
$result = [];
|
||||
foreach (self::AREAS as $area) {
|
||||
if (self::unitScoped($area) === $unit) {
|
||||
foreach (self::ACTIONS as $action) { $result[] = "$area.$action"; }
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user