<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Admin\Model; use Illuminate\Database\Eloquent\Model; use ModStart\Core\Dao\ModelUtil; class AdminUser extends Model { protected $table = 'admin_user'; public function roles() { return $this->belongsToMany(AdminRole::class, 'admin_user_role', 'userId', 'roleId'); } public static function getCached($TQ2vQ) { return ModelUtil::get('admin_user', $TQ2vQ); } protected static function boot() { parent::boot(); static::deleting(function (AdminUser $BWo2e) { $BWo2e->roles()->detach(); }); } }