Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
indent_size = 2
trim_trailing_whitespace = true

[*.md]
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ Add the following line to the providers array in config/app.php or bootstrap/pro
php artisan filterable:make-filter PostFilter --filters=title,status
```

To generate the class in a custom namespace or directory:

```bash
php artisan filterable:make-filter PostFilter \
--namespace="Modules\\Blog\\App\\Filters" \
--path="Modules/Blog/app/Filters"
```

**2. Define your filters**

```php
Expand Down
8 changes: 6 additions & 2 deletions config/filterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
| Eloquent Filter Settings
|--------------------------------------------------------------------------
|
| This is the namespace all you Eloquent Model Filters will reside
| This is the default namespace used when generating new filter classes.
| You can override it per command with:
| php artisan filterable:make-filter UserFilter --namespace="Modules\Blog\App\Filters"
|
*/
'namespace' => 'App\\Http\\Filters',
Expand All @@ -18,7 +20,9 @@
| Path of saving new filters
|--------------------------------------------------------------------------
|
| This is the namespace all you Eloquent Model Filters will reside
| This is the default directory used when creating new filter files.
| You can override it per command with:
| php artisan filterable:make-filter UserFilter --path="Modules/Blog/app/Filters"
|
*/
'save_filters_at' => app_path('Http/Filters'),
Expand Down
12 changes: 11 additions & 1 deletion docs/cli/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ When executed, this command will:
php artisan filterable:make-filter PostFilter --filters=author,title
```

If you need to generate a filter in a custom location, you can override the
default target at generation time:

```bash
php artisan filterable:make-filter PostFilter \
--namespace="Modules\\Blog\\App\\Filters" \
--path="Modules/Blog/app/Filters"
```

---

### **Example Output**
Expand All @@ -67,7 +76,7 @@ When executed, this command will:
📁 Created directory: app/Http/Filters

🎉 Setup complete! You can now create your first filter with:
php artisan filterable:make PostFilter --filters=test
php artisan filterable:make-filter PostFilter --filters=test
```

---
Expand All @@ -76,6 +85,7 @@ php artisan filterable:make PostFilter --filters=test

- Use the `--force` flag if you want to **re-publish** the configuration file and overwrite existing settings.
- The command automatically detects whether the `app/Http/Filters` directory already exists.
- `filterable:make-filter` uses the defaults from `config/filterable.php`, but you can override them per run with `--namespace` and `--path`.

---

Expand Down
Loading
Loading