orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.26k stars 631 forks source link

Button on screen with pagination enabled throws an exception: method not found #2845

Open nyrov opened 1 week ago

nyrov commented 1 week ago

Describe the bug Hello. I have a screen with pagination enabled, so pages comes with URLs like /images/all?page=1

I place a button in a modal window on the screen. Like that: Layout::modal (async) .. Layout::table .... TD::make ...... ->render ........ Button::make('text')->method('setImage', [ ........ 'preview' => $preview->id, ........ 'image' => $this->image->id, ........ ]),

Buttons are created with: formaction="http://.../images/all?page=1/setImage?preview=629&image=75"

That's because Button.php:81 $action = rtrim("{$url}/{$this->get('method')}?{$query}", '/?');

and $url = http://.../images/all?page=1

So then I click on the button it throws an exception: method all() not found If I open URL without ?page=1 everything works as expected.

How can it be fixed? Thanks!