where('id', $this->input('rowId')) ->first(); return $product !== null && Gate::allows('addToBasket', $product); } /** @return array */ public function rules(): array { return [ 'rowId' => ['required', 'string', 'uuid', 'exists:products,id'], 'qty' => ['required', 'integer', 'min:1'], ]; } public function getProductId(): ProductId { return new ProductId( Uuid::fromString( $this->string('rowId')->value() ) ); } }