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

Fix needed in the default controller Stub #11

Closed
wants to merge 35 commits into from

Conversation

andythedude
Copy link

@andythedude andythedude commented Jan 31, 2022

in stubs/Controller.stub

if (!empty($get)) {
            $models = $this->applyFilters({{modelName}}::class)->paginate();

            return view('{{modelView}}.index', [
                'models' => $models,
               //'links' => $models->links(),                 //old line
                'links' => $models->appends($get)->links(), //new line
                'get' => $get,
                'sort' => isset($get['sort']) && $get['sort'] ? $get['sort'] : '',
                'sort_icon' => self::sortIcon($get),
            ])->with('i', (request()->input('page', 1) - 1) * $models->perPage());
        }

add "appends($get)", to the links when filtering (currently causes filters to not carry across pagination)

@awais-vteams
Copy link
Owner

You should do all customization in your own project.
You can copy all stubs and update the stub_path in config crud.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants