Setting Up Filterable
Purpose
The filterable:setup command initializes the Filterable package in your application. It publishes the packageโs configuration file and ensures that the required directory structure (for filters) exists. This command is typically the first step after installing the package.
Usage
php artisan filterable:setup
Options
| Option | Description | Example |
|---|---|---|
--force | Overwrite the existing configuration file if it already exists. | php artisan filterable:setup --force |
What It Does
When executed, this command will:
Publish Configuration File It runs:
php artisan vendor:publish --tag=filterable-configand places the configuration file in:
config/filterable.phpEnsure Directory Structure Exists It creates:
app/Http/Filtersif it doesnโt already exist, ensuring you have a proper place to store your custom filters.
Provide Next Steps After setup, it suggests how to create your first filter:
php artisan filterable:make-filter PostFilter --filters=author,title
Example Output
๐ Setting up Filterable package...
โ
Configuration file published: config/filterable.php
๐ Created directory: app/Http/Filters
๐ Setup complete! You can now create your first filter with:
php artisan filterable:make PostFilter --filters=test
Notes
- Use the
--forceflag if you want to re-publish the configuration file and overwrite existing settings. - The command automatically detects whether the
app/Http/Filtersdirectory already exists.
When to Use
- Right after installing the
kettasoft/filterablepackage. - When upgrading to a version that changes configuration defaults.
- When resetting your configuration to a clean state.
