Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Can I combine setupListOperation() and setup() for different widgets
    Laravel Backpack setupListOperation setup widgets CRUD operations Laravel widgets customization


Can I combine setupListOperation() and setup() for different widgets


you can combine using `setupListOperation()` and `setup()` for adding widgets in Laravel Backpack, but there are some key differences to consider:

1. Scope of Widgets:
- `setupListOperation()`: Widgets added here will only be loaded on the List operation page.
- `setup()`: Widgets added here will be loaded on all CRUD operations (List, Create, Update, etc.).

2. Timing of Widget Addition:
- `setupListOperation()`: Widgets are added after the list operation setup is complete, so you can customize the list view based on the current state.
- `setup()`: Widgets are added during the general CRUD setup, before any specific operation setup.

3. Flexibility:
- `setupListOperation()`: Allows you to add widgets specific to the list operation, giving you more control and flexibility.
- `setup()`: Provides a more global approach, where you can add widgets that should be present across all CRUD operations.

So, you can use a combination of `setupListOperation()` and `setup()` to add different sets of widgets to your Backpack CRUD:

- Use `setupListOperation()` to add widgets that are specific to the List operation, such as charts, progress bars, or custom content related to the list view.
- Use `setup()` to add global widgets that should be present on all CRUD operations, such as informational cards, notices, or common functionality.

This way, you can have a mix of operation-specific and global widgets in your Backpack admin panel, allowing you to customize the interface based on the user's current context.

Remember that the `bp-section` attribute can be used to target specific CRUD operations or sections in your custom CSS and JavaScript, which can be helpful when adding operation-specific widgets.

Citations:
[1] https://laracasts.com/discuss/channels/laravel/laravel-backpack-fusioncharts-not-working
[2] https://backpackforlaravel.com/docs/6.x/crud-operation-list-entries
[3] https://stackoverflow.com/questions/tagged/laravel-backpack?page=3&tab=newest
[4] https://backpackforlaravel.com/docs/6.x/crud-operation-show
[5] https://github.com/Laravel-Backpack/CRUD/issues/2051