Skip to content

Commit 7bf08f4

Browse files
authored
Add docs about some config options
1 parent 74b20fd commit 7bf08f4

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
|------|----------|--------|
1515
| [1.x](https://github.com/z3d0x/filament-fabricator/tree/1.x) | ^2.0 | ^8.0 |
1616
| [2.x](https://github.com/z3d0x/filament-fabricator/tree/2.x) | ^3.0 | ^8.1 |
17-
| [3.x](https://github.com/z3d0x/filament-fabricator/tree/3.x) | ^3.0 | ^8.2 |
17+
| [3.x](https://github.com/z3d0x/filament-fabricator/tree/3.x) | ^4.0 | ^8.2 |
1818

1919
## Installation
2020

docs/README.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,16 @@ an alternative one-liner way of changing block picker style is using `blockPicke
253253
```php
254254
use Z3d0X\FilamentFabricator\Enums\BlockPickerStyle;
255255
use Z3d0X\FilamentFabricator\FilamentFabricatorPlugin;
256-
256+
257257
//..
258-
258+
259259
public function panel(Panel $panel): Panel
260260
{
261261
return $panel
262262
// ...
263263
->plugins([
264264
FilamentFabricatorPlugin::make()
265-
->blockPickerStyle(BlockPickerStyle::Modal),
265+
->blockPickerStyle(BlockPickerStyle::Modal),
266266
]);
267267
}
268268
```
@@ -306,9 +306,57 @@ class AuthServiceProvider extends ServiceProvider
306306
```
307307
> If you are using [Shield](https://filamentphp.com/plugins/bezhansalleh-shield) just register the `PagePolicy` generated by it
308308
309+
## Caching
310+
311+
By default, routes will be cached in a lazy manner. That means that a page needs to be hit before it's cached.
312+
313+
If you so choose, you can also force all pages to be cached by running the following command:
314+
```bash
315+
php artisan filament-fabricator:clear-routes-cache
316+
```
317+
318+
By running the following command instead, you'll ensure the data is fresh before it's cached:
319+
```bash
320+
php artisan filament-fabricator:clear-routes-cache --refresh
321+
```
322+
323+
## Configuration
324+
325+
### Auto-routing
326+
327+
By default, your pages' routing will be done automatically for you so you don't have to worry about it.
328+
329+
To do that the package registers a fallback route which, when hit, will render your page.
330+
331+
If you want manual control over how your pages are rendered, you can disable this by setting the `routing.enabled` config option in your config file to `false`.
332+
333+
### Route prefix
334+
335+
If you so desire, you can add a prefix to be used in all your pages' routes. This is used in conjunction with auto-routing.
336+
337+
For instance: If a page has a slug `page-1`, and the prefix is set to `/pages`, then you'll access that page at the URL `/pages/page-1`.
338+
339+
> **Warning:** When changing the route prefix in the config, you'll want to run the `php artisan filament-fabricator:clear-routes-cache --refresh` command
340+
341+
### Hooking the route cache into Laravel's lifecycle
342+
343+
By default routes are properly cached, cleared, and refreshed whenever you would expect it to.
344+
345+
This is achieved by hooking into the following core commands:
346+
347+
- `cache:clear` -> clear routes cache
348+
- `config:cache` -> refresh routes cache
349+
- `config:clear` -> clear routes cache
350+
- `optimize` -> refresh routes cache
351+
- `optimize:clear` -> clear routes cache
352+
- `route:clear` -> clear routes cache
353+
354+
If you don't want this behavior, you can opt out of it by setting the `hook-to-commands` config option to `false` in your config file.
355+
309356

310357
## Compatibility
311358
| Fabricator | Filament | PHP |
312359
|------|----------|--------|
313360
| [1.x](https://github.com/z3d0x/filament-fabricator/tree/1.x) | ^2.0 | ^8.0 |
314361
| [2.x](https://github.com/z3d0x/filament-fabricator/tree/2.x) | ^3.0 | ^8.1 |
362+
| [3.x](https://github.com/z3d0x/filament-fabricator/tree/3.x) | ^4.0 | ^8.2 |

src/Listeners/OptimizeWithLaravel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class OptimizeWithLaravel
1111
{
12-
const COMMANDS = [
12+
public const COMMANDS = [
1313
'cache:clear',
1414
'config:cache',
1515
'config:clear',
@@ -18,7 +18,7 @@ class OptimizeWithLaravel
1818
'route:clear',
1919
];
2020

21-
const REFRESH_COMMANDS = [
21+
public const REFRESH_COMMANDS = [
2222
'config:cache',
2323
'optimize',
2424
];

0 commit comments

Comments
 (0)