Skip to content

Commit fd01276

Browse files
committed
Merge branch 'tonypartridge-patch-2' into develop
2 parents 0b96e3f + a5a249a commit fd01276

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/filters/applying-filters.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ public function builder(): Builder
4141

4242
You can use the `getAppliedFilterWithValue()` method to grab the current value of the filter or null if it is not applied.
4343

44+
## Apply Filters at the Component Boot Level
45+
46+
You may wish to apply default filters i.e. current month on accessing the view in this case you can use:
47+
48+
```php
49+
public function mount() {
50+
$this->setFilter('created_after', date('Y-m-d', strtotime('now -1 month'));
51+
}
52+
```
53+
4454
### A note about integer values
4555

4656
Even if you have your values as strings, but are still using integers, you may have unexpected results when using Eloquent's `when()` method to apply your filters (if going that route).

0 commit comments

Comments
 (0)