repository = $repository; $this->permissionsService = $permissionsService; } /** * Transform an individual server into a response that can be consumed by a * client using the API. * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function index(GetServerRequest $request, Server $server): array { return $this->fractal->item($server) ->transformWith($this->getTransformer(ServerTransformer::class)) ->addMeta([ 'is_server_owner' => $request->user()->id === $server->owner_id, 'user_permissions' => $this->permissionsService->handle($server, $request->user()), ]) ->toArray(); } }