/** * 获取指定用户的资料. * * @param int $id * * @return \Illuminate\Http\Response */ public function show($id) { $user = $this->users->autoWithRootColumns(User::$includable)->find($id); // 在 Transformer 中返回 links $user->links = true; return $this->response()->item($user, new UserTransformer()); }
/** * Display the specified resource. * * @param int $id * * @return \Illuminate\Http\Response */ public function show($id) { $data = $this->repository->autoWithRootColumns(['id', 'name', 'avatar', 'is_banned'])->find($id); return $this->response()->item($data, new UserTransformer()); }