From 738c4535dc769cebfc7b30dd29bdf580efeeba8d Mon Sep 17 00:00:00 2001 From: vasya Date: Sat, 21 Mar 2026 20:37:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D1=8E=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D1=8C=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D1=80=D0=BE=D0=BB=D1=8F?= =?UTF-8?q?=D0=BC=D0=B8=20=D0=BF=D0=BE=20=D0=BF=D1=80=D0=B8=D0=BB=D0=BE?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D1=8F=D0=BC=D0=B8=20magic=202.0=20=D0=B8=20?= =?UTF-8?q?=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B=20=D0=91=D0=94,=20?= =?UTF-8?q?=D0=B3=D0=B4=D0=B5=20=D1=85=D1=80=D0=B0=D0=BD=D1=8F=D1=82=D1=81?= =?UTF-8?q?=D1=8F=20=D1=80=D0=BE=D0=BB=D0=B8=20=D0=BF=D0=BE=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D1=8F=D0=BC=20magic=202.0.?= =?UTF-8?q?=20=D0=A1=D0=B5=D0=B9=D1=87=D0=B0=D1=81=20=D1=80=D0=BE=D0=BB?= =?UTF-8?q?=D0=B8=20=D1=80=D0=B0=D1=81=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D1=8F=D1=82=D1=81=D1=8F=20=D0=BF=D0=BE=20=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B8=D0=BD=D0=B0=D0=BC,=20=D0=BD=D0=B5=D0=BE=D0=B1=D1=85?= =?UTF-8?q?=D0=BE=D0=B4=D0=B8=D0=BC=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=B0=D1=82=D1=8C=20=D0=BF=D0=BE=D0=B4=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B4=D0=B0=D1=87=D1=83=20=D1=80=D0=BE=D0=BB=D0=B5=D0=B9?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B0=D0=BC=20?= =?UTF-8?q?=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B0.=20=D0=AF=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=83=D1=81=D0=BF=D0=B5=D0=BB=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B8=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/AppRoles.php | 18 ++++++++++++++++++ database/tables_for_magic2.0/app_roles.sql | 13 +++++++++++++ .../app_roles_202602271730.sql | 3 +++ 3 files changed, 34 insertions(+) create mode 100644 app/Models/AppRoles.php create mode 100644 database/tables_for_magic2.0/app_roles.sql create mode 100644 database/tables_for_magic2.0/app_roles_202602271730.sql diff --git a/app/Models/AppRoles.php b/app/Models/AppRoles.php new file mode 100644 index 0000000..4f8bd18 --- /dev/null +++ b/app/Models/AppRoles.php @@ -0,0 +1,18 @@ +belongsTo(MagicApps::class, 'app_id', 'id'); + } +} diff --git a/database/tables_for_magic2.0/app_roles.sql b/database/tables_for_magic2.0/app_roles.sql new file mode 100644 index 0000000..16fd62c --- /dev/null +++ b/database/tables_for_magic2.0/app_roles.sql @@ -0,0 +1,13 @@ +-- custom.app_roles definition + +CREATE TABLE `app_roles` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `app_id` bigint(20) unsigned NOT NULL COMMENT 'id приложения (связь с таблицей magic_apps)', + `app_role` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Роль в приложении', + `app_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Название роли на русском', + `role_priority` smallint(6) NOT NULL COMMENT 'Приоритет роли', + `role_access` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Кому доступна роль (зависит от драйвера в magic_apps)', + PRIMARY KEY (`id`), + KEY `app_roles_app_id_foreign` (`app_id`), + CONSTRAINT `app_roles_app_id_foreign` FOREIGN KEY (`app_id`) REFERENCES `magic_apps` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Ролевая модель приложений'; \ No newline at end of file diff --git a/database/tables_for_magic2.0/app_roles_202602271730.sql b/database/tables_for_magic2.0/app_roles_202602271730.sql new file mode 100644 index 0000000..e8bf79e --- /dev/null +++ b/database/tables_for_magic2.0/app_roles_202602271730.sql @@ -0,0 +1,3 @@ +INSERT INTO custom.app_roles (app_id,app_role,app_title,role_priority,role_access) VALUES + (4,'admin','Администратор',1,'# Magic_admins'), + (4,'user','Пользователь',2,'# Test');