-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Using DB pagination methods inside a command throws an exception #478
Comments
I don't see why not. 🤔 👍🏻 Feel free to PR it. 🙂 Ping @nunomaduro, do you know if there was a reason that this was excluded? |
karasibille
added a commit
to karasibille/laravel-zero-framework
that referenced
this issue
Jan 4, 2024
When using the Eloquent query builder pagination methods, like this : ```php DB::table('users')->paginate(perPage: 15, page: 1); ``` Laravel tries to acces the `request` binding — and by doing so throws this Exception : ``` Illuminate\Contracts\Container\BindingResolutionException Target class [request] does not exist. ``` To fix this error we add the this class to the bootstrappers list of the Kernel : ``` \Illuminate\Foundation\Bootstrap\SetRequestForConsole::class ``` Ref laravel-zero/laravel-zero#478
karasibille
added a commit
to karasibille/laravel-zero-framework
that referenced
this issue
Jan 4, 2024
When using the Eloquent query builder pagination methods, like this : ```php DB::table('users')->paginate(perPage: 15, page: 1); ``` Laravel tries to acces the `request` binding — and by doing so throws this Exception : ``` Illuminate\Contracts\Container\BindingResolutionException Target class [request] does not exist. ``` To fix this error, we add this class to the bootstrappers list of the Kernel : ``` \Illuminate\Foundation\Bootstrap\SetRequestForConsole::class ``` Ref laravel-zero/laravel-zero#478
karasibille
added a commit
to karasibille/laravel-zero-framework
that referenced
this issue
Jan 4, 2024
When using the Eloquent query builder pagination methods, like this : ```php DB::table('users')->paginate(perPage: 15, page: 1); ``` Laravel tries to acces the `request` binding — and by doing so throws this Exception : ``` Illuminate\Contracts\Container\BindingResolutionException Target class [request] does not exist. ``` To fix this error, we add this class to the bootstrappers list of the Kernel : ```php \Illuminate\Foundation\Bootstrap\SetRequestForConsole::class ``` Ref laravel-zero/laravel-zero#478
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After installing the database add-on, and the
illuminate/pagination
package, when doing something like :The
paginate()
call results in an exception, as we can see in the following stack trace (I'm only showing what's after the call topaginate
) :I have found a solution to fix this by extending the
LaravelZero\Framework\Kernel
class and overriding the$bootstrappers
field like so :Would you consider accepting a pull request that adds this line in
LaravelZero\Framework\Kernel
? If so, I would be happy to contribute 🙂The text was updated successfully, but these errors were encountered: