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');