service = $service; } public function index() { $params = $this->valid([ "page_size" => "int", ]); return $this->ok($this->service->paginate(Auth::user(), $params)); } public function del() { $params = $this->valid([ "ids" => "required|array", ]); $row = Cart::whereIn("id", $params['ids'])->where("user_id", Auth::id())->delete(); return $this->ok([ "row" => $row, ]); } public function ask() { $params = $this->valid([ "ids" => "required|array", ]); return $this->ok($this->service->ask(Auth::user(), $params)); } public function store() { $params = $this->valid([ "id" => "required", "count" => "required", ]); $cart = app(CartService::class)->update(Auth::user(), $params); return $this->ok([ "id" => $cart->id, ]); } }