laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

Undefined method 'withQueryString'

Open pixieaka opened this issue 3 years ago • 18 comments

Versions:

  • ide-helper Version: 2.10.0
  • Laravel Version: 8.73.1
  • PHP Version: 8.0.12
  • Editor: VsCode 1.62.3

Description:

Undefined method 'withQueryString'.intelephense(1013)

image image

Steps To Reproduce:

Just fresh Laravel app

pixieaka avatar Nov 23 '21 22:11 pixieaka

Any update with this issue? Got the same problem unfortunately :(

fahmiegerton avatar Jan 01 '22 04:01 fahmiegerton

I have got the same problem.

chathurakodikara avatar Feb 16 '22 09:02 chathurakodikara

Same issue here

AGuyNamedJens avatar Feb 21 '22 07:02 AGuyNamedJens

Same issue here as well.

abdobouna avatar Feb 22 '22 21:02 abdobouna

me too.

mankowitz avatar Feb 27 '22 10:02 mankowitz

Same for me

dgurak avatar Mar 11 '22 20:03 dgurak

+1

widdydev avatar Mar 12 '22 14:03 widdydev

wow, today 25 may 2022 and still face this problem

febryntara avatar May 24 '22 15:05 febryntara

+1

shantiwebsolution avatar May 28 '22 04:05 shantiwebsolution

+1

willymac1507 avatar Jul 19 '22 13:07 willymac1507

Same issue

MooseSaeed avatar Jul 22 '22 17:07 MooseSaeed

It's been 6 months, time to get a different plugin i guess

AGuyNamedJens avatar Jul 22 '22 17:07 AGuyNamedJens

🔴 Problem

  • The withQueryString() works but it is not recognize in the laravel query types nor Ide-helper package.

🟢 Solution

  • You can use appends instead of withQueryString()

here's how:


$users =  User::query()
           ->paginate(15)
           ->appends($request->all());

other way:

->appends(['search' => $request->search]);

->appends($request->only('search'));

🔗 Reference

  • https://laravel.com/docs/9.x/pagination#appending-query-string-values

phojie avatar Nov 12 '22 05:11 phojie

Another way to fix this, which works if you don't have acces to the request object anymore

        /**@var LengthAwarePaginator */
        $paginate = User::query()->paginate(10);
        return $paginate->withQueryString();

Temepest74 avatar May 17 '23 08:05 Temepest74

Has same problem with toArray due to it returning the contract and not the class which implements the Arrayable interface. Mentioned in #741. The solution above does work. Just mentioning for fellow travelers.

manning390 avatar Oct 26 '23 19:10 manning390

The same issue persists.

I'm going with https://github.com/barryvdh/laravel-ide-helper/issues/1278#issuecomment-1551013786 for now.

the-turk avatar Mar 25 '24 17:03 the-turk