laravel-ide-helper
laravel-ide-helper copied to clipboard
Undefined method 'withQueryString'
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)
Steps To Reproduce:
Just fresh Laravel app
Any update with this issue? Got the same problem unfortunately :(
I have got the same problem.
Same issue here
Same issue here as well.
me too.
Same for me
+1
wow, today 25 may 2022 and still face this problem
+1
+1
Same issue
It's been 6 months, time to get a different plugin i guess
🔴 Problem
- The
withQueryString()
works but it is not recognize in the laravel query types nor Ide-helper package.
🟢 Solution
- You can use
appends
instead ofwithQueryString()
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
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();
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.
The same issue persists.
I'm going with https://github.com/barryvdh/laravel-ide-helper/issues/1278#issuecomment-1551013786 for now.