identityFirst(); if ($identity->id > 2) { $order = true; } else { $order = false; } return [ 'user_id' => $this->id, 'username' => $this->username, 'nickname' => $this->info->nickname ?? '', 'avatar' => $this->info->avatar ?? '', 'account' => new UserAccountResource($this->account), 'identity' => new UserIdentityBaseResource($identity), // 'service' => new UserServiceResource($identity->identities()->first()), // 'water_mobile' => app('Conf_mall')['water_mobile'] ?? '', 'invite' => Hashids::connection('code')->encode($this->id), 'area_code' => $this->info->area_code, // 'case' => $this->getStockData(), 'created_at' => (string) $this->created_at, 'status' => $this->getStateData(), // 'nowStatus' => $this->getNowStatus(), // 'canPick' => $this->canPick(), 'count' => [ 'relation' => $this->getRelationCount(),//下级 'orders' => $this->getOrderCount(), ], 'can' => [ 'area' => $this->areas()->exists(), ], 'identityShow' => $this->when(true, function () use ($identity) { return [ 'right' => new UserIdentityRightsResource($identity), 'times' => new IdentityMiddleResource($this->identityMiddle()->first()), 'is_top' => $identity->id == 4, ]; }), ]; } }