123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Models;
- class AdminRole extends Model
- {
- protected $fillable = ['name', 'slug', 'admin_id', 'merchant_id'];
- const AREA_ADMIN = 'admin-area';
- const ADMINISTROTOR = 'administrator'; // 技术管理员
- const MERCHANTSADMIN = 'merchantsAdmin'; // 商户管理员
- const NORMALADMINISTRATOR = 'normalAdministrator';// 超级管理员
- public function permissions()
- {
- return $this->belongsToMany(
- AdminPermission::class,
- 'admin_role_permission',
- 'role_id',
- 'permission_id'
- );
- }
- public function vue_routers()
- {
- return $this->belongsToMany(
- VueRouter::class,
- 'vue_router_role',
- 'role_id',
- 'vue_router_id'
- );
- }
- public function delete()
- {
- $this->permissions()->detach();
- $this->vue_routers()->detach();
- return parent::delete();
- }
- }
|