service = $service; } public function goods() { $params = $this->valid([ "id" => "required", ]); return $this->ok($this->service->info($params)); } public function fav() { $params = $this->valid([ "id" => "required", ]); return $this->ok([ "was_created" => app(FavService::class)->fav(Auth::id(), $params)->wasRecentlyCreated, ]); } public function ask() { $params = $this->valid([ "id" => "required", "custom" => "", "count" => "", ]); $params['source'] = Order::SOURCE_GOODS; return $this->ok(app(OrderService::class)->askOne(Auth::user(), $params)); } public function cart() { $params = $this->valid([ "id" => "required", 'count' => "required", "custom" => "", ]); $cart = app(CartService::class)->add(Auth::user(), $params); return $this->ok([ "id" => $cart->id, ]); } }