Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method 'withQueryString' #1278

Closed
pixieaka opened this issue Nov 23, 2021 · 27 comments
Closed

Undefined method 'withQueryString' #1278

pixieaka opened this issue Nov 23, 2021 · 27 comments
Labels

Comments

@pixieaka
Copy link

pixieaka commented Nov 23, 2021

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 pixieaka added the bug label Nov 23, 2021
@fahmiegerton
Copy link

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

@chathurakodikara
Copy link

I have got the same problem.

@AGuyNamedJens
Copy link

Same issue here

@abdobouna
Copy link

Same issue here as well.

@mankowitz
Copy link

me too.

@dgurak
Copy link

dgurak commented Mar 11, 2022

Same for me

@widdydev
Copy link

+1

@febryntara
Copy link

wow, today 25 may 2022 and still face this problem

@shantiwebsolution
Copy link

+1

1 similar comment
@willymac1507
Copy link

+1

@MooseSaeed
Copy link

Same issue

@AGuyNamedJens
Copy link

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

@phojie
Copy link

phojie commented Nov 12, 2022

🔴 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

@Temepest74
Copy link

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();

@manning390
Copy link

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.

@hasan-ozbey
Copy link

The same issue persists.

I'm going with #1278 (comment) for now.

@adrianaditech
Copy link

Same issue.
I use this all the time which works perfectly fine and is part of Laravel:
$locations = ClinicLocation::onlyTrashed()->paginate($perPage)->withQueryString();
but VS Code shows Undefined Method.
image

Other times (even in the same file!) it has no problems:
image

@Adesin-fr
Copy link

Still facing this issue !

@sergey-k1
Copy link

Don't use the method query()
image

@dvlpr91
Copy link

dvlpr91 commented Feb 3, 2025

Wow, happy new year.

The problem that started in 2021 is still with us in 2025.

@dvlpr91
Copy link

dvlpr91 commented Feb 3, 2025

This minor issue will be solved by my contribution to the Laravel project in the near future.

@pixieaka
Copy link
Author

pixieaka commented Feb 3, 2025

@dvlpr91 Can you share with us the link to your contribution ?

@dvlpr91
Copy link

dvlpr91 commented Feb 4, 2025

@dvlpr91 Can you share with us the link to your contribution ?

laravel/framework#54460

@dvlpr91
Copy link

dvlpr91 commented Feb 4, 2025

Unfortunately, this is not going to be fixed.

I've been asked to request a merge to the next version of the branch because of compatibility issues.

However, I won't do it because I can't be bothered.

10 years later, let's try again.

@dvlpr91
Copy link

dvlpr91 commented Feb 4, 2025

It's harder to wait 10 years, so I just did it up front.

If this PR is rejected, I'll give up.

laravel/framework#54462

@dvlpr91
Copy link

dvlpr91 commented Feb 6, 2025

@pixieaka

Sleep well tonight.

It's 2025, and the problem is finally fixed.

This issue should resolve itself later this month with the release of version 12.

If you don't upgrade to version 12, you'll have to use phpdoc to fix it.

@pixieaka
Copy link
Author

pixieaka commented Feb 7, 2025

@dvlpr91 Thank you 🙏 I really appreciate it.

@pixieaka pixieaka closed this as completed Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests