|
|
@@ -3,8 +3,8 @@
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
use App\Models\Permission;
|
|
|
-use Illuminate\Database\Seeder;
|
|
|
use App\Services\PermissionService;
|
|
|
+use Illuminate\Database\Seeder;
|
|
|
|
|
|
class PermissionSeeder extends Seeder
|
|
|
{
|
|
|
@@ -16,113 +16,125 @@ public function run(): void
|
|
|
{
|
|
|
$permissions = [
|
|
|
[
|
|
|
- "scope" => "dashboard",
|
|
|
+ "scope" => "dashboard",
|
|
|
"description" => "Dashboard",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "franchisee",
|
|
|
+ "scope" => "franchisee",
|
|
|
"description" => "Franchisee",
|
|
|
- "bits" => Permission::MENU | Permission::VIEW,
|
|
|
- "children" => [
|
|
|
+ "bits" => Permission::MENU | Permission::VIEW,
|
|
|
+ "children" => [
|
|
|
[
|
|
|
- "scope" => "unit",
|
|
|
+ "scope" => "unit",
|
|
|
"description" => "Unidades",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "class-package",
|
|
|
+ "scope" => "class-package",
|
|
|
"description" => "Pacotes (Franqueadora)",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "class-package-unit",
|
|
|
+ "scope" => "class-package-unit",
|
|
|
"description" => "Pacotes (Unidade)",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "student-contract",
|
|
|
+ "scope" => "student-contract",
|
|
|
"description" => "Contratos de Alunos",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "tbr",
|
|
|
+ "scope" => "tbr",
|
|
|
"description" => "TBR",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [
|
|
|
[
|
|
|
- "scope" => "royalties-base-bracket",
|
|
|
+ "scope" => "royalties-base-bracket",
|
|
|
"description" => "Faixas de Royalties Base",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "fnm-base-bracket",
|
|
|
+ "scope" => "fnm-base-bracket",
|
|
|
"description" => "Faixas de FNM Base",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "maintenance-base-bracket",
|
|
|
+ "scope" => "maintenance-base-bracket",
|
|
|
"description" => "Faixas de Manutenção Base",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "franchisee-tbr",
|
|
|
+ "scope" => "franchisee-tbr",
|
|
|
"description" => "TBR por Franqueado",
|
|
|
- "bits" => Permission::ALL_PERMS,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "tbr-calculation",
|
|
|
+ "scope" => "tbr-calculation",
|
|
|
"description" => "Cálculo de TBR",
|
|
|
- "bits" => Permission::VIEW | Permission::ADD,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::VIEW | Permission::ADD,
|
|
|
+ "children" => [],
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ "scope" => "inhabitant-classification",
|
|
|
+ "description" => "Classificações de Habitantes",
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ "scope" => "unit-inhabitant-classification",
|
|
|
+ "description" => "Classificações de Habitantes por Unidade",
|
|
|
+ "bits" => Permission::ALL_PERMS,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "config",
|
|
|
+ "scope" => "config",
|
|
|
"description" => "Configurações",
|
|
|
- "bits" => Permission::MENU | Permission::VIEW,
|
|
|
- "children" => [
|
|
|
+ "bits" => Permission::MENU | Permission::VIEW,
|
|
|
+ "children" => [
|
|
|
[
|
|
|
- "scope" => "config.user",
|
|
|
+ "scope" => "config.user",
|
|
|
"description" => "Configurações de Usuários",
|
|
|
- "bits" => Permission::CRUD,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::CRUD,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "config.permission",
|
|
|
+ "scope" => "config.permission",
|
|
|
"description" => "Configurações de Permissões",
|
|
|
- "bits" => Permission::CRUD,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::CRUD,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "config.city",
|
|
|
+ "scope" => "config.city",
|
|
|
"description" => "Configurações de Cidades",
|
|
|
- "bits" => Permission::CRUD,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::CRUD,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "config.country",
|
|
|
+ "scope" => "config.country",
|
|
|
"description" => "Configurações de Países",
|
|
|
- "bits" => Permission::CRUD,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::CRUD,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
[
|
|
|
- "scope" => "config.state",
|
|
|
+ "scope" => "config.state",
|
|
|
"description" => "Configurações de Estados",
|
|
|
- "bits" => Permission::CRUD,
|
|
|
- "children" => [],
|
|
|
+ "bits" => Permission::CRUD,
|
|
|
+ "children" => [],
|
|
|
],
|
|
|
],
|
|
|
],
|
|
|
@@ -143,6 +155,7 @@ private function createPermissionsAndChildren(
|
|
|
): void {
|
|
|
foreach ($permissions as $permissionData) {
|
|
|
$children = $permissionData["children"];
|
|
|
+
|
|
|
unset($permissionData["children"]);
|
|
|
|
|
|
$permissionNode = Permission::updateOrCreate(
|
|
|
@@ -157,7 +170,7 @@ private function createPermissionsAndChildren(
|
|
|
if (!empty($children)) {
|
|
|
$this->createPermissionsAndChildren(
|
|
|
permissions: $children,
|
|
|
- parent: $permissionNode,
|
|
|
+ parent: $permissionNode,
|
|
|
);
|
|
|
}
|
|
|
}
|