'integer', 'sort' => 'integer', 'status' => 'integer', ]; protected $hidden = [ 'deleted_at' ]; /** * 定义与用户的关联关系(一个部门有多个用户) */ public function users(): HasMany { return $this->hasMany(SysUserModel::class, 'dept_id', 'id'); } /** * 定义父级部门关联 */ public function parent(): BelongsTo { return $this->belongsTo(SysDeptModel::class, 'parent_id', 'id'); } /** * 定义子部门关联 */ public function children(): HasMany { return $this->hasMany(SysDeptModel::class, 'parent_id', 'id'); } }