Download the PHP package mozex/laravel-scout-bulk-actions without Composer
On this page you can find all versions of the php package mozex/laravel-scout-bulk-actions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mozex/laravel-scout-bulk-actions
More information about mozex/laravel-scout-bulk-actions
Files in mozex/laravel-scout-bulk-actions
Package laravel-scout-bulk-actions
Short Description A Laravel Scout extension for bulk importing and flushing of all models.
License MIT
Homepage https://github.com/mozex/laravel-scout-bulk-actions
Informations about the package laravel-scout-bulk-actions
Laravel Scout Bulk Actions
Laravel Scout Bulk Actions is a comprehensive Laravel package designed to simplify and streamline your work when dealing with many models. If you've ever found it difficult to import or flush all records of each model into the index one by one, then this package is a game changer for you.
Our package alleviates the limitations of Laravel Scout's native commands scout:import <model>
and scout:flush <model>
by allowing you to perform these actions across all models simultaneously. This functionality can save considerable time and effort, especially when developing and testing projects with many models.
- Laravel Scout Bulk Actions
- Features
- Why Laravel Scout Bulk Actions?
- Support Us
- Installation
- Configuration
- Usage
- Importing All Models
- Flushing All Models
- Refreshing All Models
- Refreshing Specific Model
- How Does It Work?
- Testing
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
Features
scout:import-all
: Imports all records from all models into the index at once, removing the need to run individual commands for each model.scout:flush-all
: Allows you to clear all records from the index for all models in one fell swoop instead of having to execute commands for each model separately.scout:refresh
: This command sequentially performs a flush and an import operation. The beauty of this command is in its flexibility. Pass a model name to this command, and it will only refresh that specific model. Leave it blank, and it refreshes every model.
Why Laravel Scout Bulk Actions?
When dealing with many models, it can quickly become cumbersome to import and flush records for each model individually. This is especially true in the development phase, where such operations must be performed multiple times. By facilitating bulk actions on all models, our package significantly reduces the time and effort required for these operations.
For large-scale applications with several models, Laravel Scout Bulk Actions is an indispensable tool that dramatically enhances your productivity and efficiency. Enjoy less time typing commands and more time crafting your Laravel masterpiece. Your testing phase will thank you for it!
In summary, Laravel Scout Bulk Actions is designed to improve and simplify your Laravel Scout experience. It's a small package with significant benefits that have the potential to make a massive difference in your Laravel project. So why wait? Give Laravel Scout Bulk Actions a try today!
Support Us
Creating and maintaining open-source projects requires significant time and effort. Your support will help enhance the project and enable further contributions to the Laravel community.
Sponsorship can be made through the GitHub Sponsors program. Just click the "Sponsor" button at the top of this repository. Any amount is greatly appreciated, even a contribution as small as $1 can make a big difference and will go directly towards developing and improving this package.
Thank you for considering sponsoring. Your support truly makes a difference!
Installation
You can install the package via composer:
Configuration
You can publish the config file with:
After publishing the config file, a configuration file named scout-bulk-actions.php
will be created in your config
directory. You can define which directories to scan for models that are using the Searchable
trait in this file.
This is the contents of the published config file:
You can add any path to the model_directories
array. This is where you tell Laravel Scout Bulk Actions where to look for your models. For instance, app_path('Models')
will target the app/Models
directory.
The model_directories
array also accepts glob patterns. This can be useful if your models are spread across multiple directories. For example, if you have a directory for each module in your application, and each of these module directories has a Models
subdirectory, you could add a path like base_path('Modules/*/Models')
to include all these Models
directories at once.
Remember to clear your config cache using php artisan config:clear
if you make any changes to the configuration file and
your application is in production mode.
Usage
Once the package is installed, you'll have access to three new Artisan commands:
scout:import-all
scout:flush-all
scout:refresh
Importing All Models
To import all models into the Scout index, use the scout:import-all
command:
This will loop through all your Scout Searchable models and import them into your Scout index.
Flushing All Models
To remove all models from the Scout index, use the scout:flush-all
command:
This will loop through all your Scout Searchable models and flush them from your Scout index.
Refreshing All Models
To refresh (flush and then import) all models data in your Scout index, use the scout:refresh
command:
This will flush all models from your Scout index and then import them again.
Refreshing Specific Model
The scout:refresh
command can also be used with a specific model name. This will only refresh the index for the given model:
If no model name is passed to the scout:refresh command, it will refresh all models.
How Does It Work?
The Laravel Scout Bulk Actions package has been designed to automatically identify and interact with all models in your Laravel application that use Scout's Searchable trait.
Upon execution of a command, the package will first scan the directories specified in the config file for models. This is done to find all models utilizing Laravel Scout's Searchable trait.
Once the models have been identified, the package will then execute Scout's native import or flush commands on each of these models, depending on the command you've chosen to run.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Mozex
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-scout-bulk-actions with dependencies
illuminate/contracts Version ^10.0|^11.0
laravel/prompts Version ^0.1.15|^0.2.0|^0.3.0
laravel/scout Version ^10.2
spatie/laravel-package-tools Version ^1.14.0