добавляю модель работы со всеми приложениями magic 2.0 и таблицы БД, где хранятся приложения magic 2.0

This commit is contained in:
vasya
2026-03-21 19:51:37 +03:00
parent 123fc969f0
commit c541c09277
3 changed files with 37 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\AppRoles;
class MagicApps extends Model
{
protected $table = 'magic_apps';
use HasFactory;
public function appRoles()
{
return $this->hasMany(AppRoles::class, 'app_id', 'id')
->orderBy('role_priority', 'asc');
}
}
@@ -0,0 +1,13 @@
-- custom.magic_apps definition
CREATE TABLE `magic_apps` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`app_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Имя приложения',
`app_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Название приложения на русском',
`app_link` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`role_driver` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Драйвер определения ролей: по группам AD, по почтовым рассылкам, по логинам. NULL, если ролевая модель не предусмотрена',
`access_groups_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Доступ к приложениям по почтовым рассылкам',
`access_groups_ad` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Доступ к приложениям по группам AD',
`is_active` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Активно ли приложение',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -0,0 +1,5 @@
INSERT INTO custom.magic_apps (app_name,app_title,app_link,role_driver,access_groups_email,access_groups_ad,is_active) VALUES
('Test','','test.index',NULL,NULL,'CTXAL.CryptoPRO',1),
('About','','about',NULL,NULL,'CTXAL.CryptoPRO',1),
('Test create','','test.create',NULL,NULL,'CTXAL.CryptoPRO',1),
('taxi','Реестр заказа такси','test','email','# Magic_admins',NULL,1);