Skip to content

Commit 18e2a6a

Browse files
committed
Update docs
1 parent 61d525b commit 18e2a6a

File tree

2 files changed

+123
-23
lines changed

2 files changed

+123
-23
lines changed

README.md

Lines changed: 119 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/statikbe/laravel-filament-flexible-content-block-pages/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/statikbe/laravel-filament-flexible-content-block-pages/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
66
[![Total Downloads](https://img.shields.io/packagist/dt/statikbe/laravel-filament-flexible-content-block-pages.svg?style=flat-square)](https://packagist.org/packages/statikbe/laravel-filament-flexible-content-block-pages)
77

8-
A complete CMS solution for Laravel applications built on [Filament Flexible Content Blocks](https://github.com/statikbe/laravel-filament-flexible-content-blocks). This package extends the flexible content block system into a full page management solution with routing, SEO, menus, and multilingual support.
8+
A CMS solution for Laravel applications built on [Filament Flexible Content Blocks](https://github.com/statikbe/laravel-filament-flexible-content-blocks).
9+
This package extends the flexible content block system, into a full page management solution with routing, SEO, menus, and multilingual support.
910

10-
Designed for developers who need a content management system that integrates seamlessly with existing Laravel applications while providing editors with an intuitive interface for managing pages and content.
11+
Designed for developers who need a content management system that integrates seamlessly with existing Laravel Filament application,
12+
while providing content editors with an intuitive interface for managing pages and content.
1113

1214
## Key Features
1315

1416
- **Flexible page management** - Create pages with hero images, flexible content blocks, SEO fields, and publication controls
15-
- **Hierarchical menu builder** - Configurable depth with drag-and-drop interface for creating navigation menus
17+
- **Hierarchical menu builder** - Drag-and-drop interface for creating navigation menus
1618
- **Multilingual support** - Full localization with automatic route generation for multiple languages
17-
- **SEO tools** - Automatic sitemap generation, meta tag management, and URL redirect handling
19+
- **SEO tools** - Automatic sitemap generation, meta tag management, and URL redirect handling when slugs change
1820
- **Ready-to-use admin interface** - Pre-configured Filament panel with all resources and management tools
19-
- **Developer-friendly** - Extendable models, customizable templates, and comprehensive configuration options
21+
- **Developer-friendly** - Extendable models & tables, customizable templates, and comprehensive configuration options
2022
- **Content organization** - Tag system, hierarchical page structure, and settings management
2123

2224
## Additional Features
@@ -26,9 +28,11 @@ Designed for developers who need a content management system that integrates sea
2628
- Media library integration via Spatie packages
2729
- Automatic 301 redirects when page URLs change
2830
- Multiple sitemap generation methods (manual, crawling, hybrid)
29-
- Configurable content block types and layouts
31+
- Configurable content blocks and layouts
3032

31-
This package combines several Laravel packages into a cohesive CMS solution, making it opinionated but comprehensive for typical content management needs.
33+
## Table of contents
34+
35+
TODO
3236

3337
## Installation
3438

@@ -81,11 +85,16 @@ You can now seed the home page and default settings by running:
8185
php artisan flexible-content-block-pages:seed
8286
```
8387

84-
Further configure the third-party packages that are used. Check the installation documentation of these packages:
88+
Further configure the [third-party packages that are used](#credits). Check the installation documentation of the following packages:
89+
90+
### [Laravel Filament Flexible Content Blocks](https://github.com/statikbe/laravel-filament-flexible-content-blocks)
91+
92+
Probably, you will want to tweak the configuration of the Flexible blocks package. Publish the configuration using [the
93+
installation guide](https://github.com/statikbe/laravel-filament-flexible-content-blocks?tab=readme-ov-file#installation).
8594

8695
### [Laravel Localization](https://github.com/mcamara/laravel-localization?tab=readme-ov-file#installation):
8796

88-
Make sure the middlewares are properly setup if you want to use localised routes.
97+
Make sure the middlewares are properly set up if you want to use localised routes.
8998

9099
### [Laravel Tags](https://spatie.be/docs/laravel-tags/v4/installation-and-setup):
91100

@@ -98,7 +107,7 @@ Publish the config and change the tag model to the package model:
98107

99108
Check [the configuration documentation](#configuration) for more explanations on how to tweak the package.
100109

101-
Optionally, you can publish the views using
110+
Most likely you want to publish the views, so you can customise it for your project:
102111

103112
```bash
104113
php artisan vendor:publish --tag="filament-flexible-content-block-pages-views"
@@ -110,7 +119,7 @@ php artisan vendor:publish --tag="filament-flexible-content-block-pages-views"
110119

111120
If you want translated content and routes, go through the following steps:
112121

113-
1. Configure the supported locales in the Filament Flexible Content Blocks configuration
122+
1. Configure the `supported_locales` in the Filament Flexible Content Blocks configuration or in a service provider
114123
2. Configure the `route_helper` in [`filament-flexible-content-block-pages.php`](./config/filament-flexible-content-block-pages.php)
115124

116125
### Routes
@@ -153,9 +162,8 @@ The package includes a powerful hierarchical menu builder with a drag-and-drop i
153162
### Features
154163

155164
- **Hierarchical structure** - With configurable max depth per menu
156-
- **Multiple link types** - Internal routes, external URLs, and linkable models (Pages or your own project model)
165+
- **Multiple link types** - Internal routes, external URLs, and linkable models (Pages or your own project models)
157166
- **Drag & drop management** - Intuitive tree interface for reordering and nesting items
158-
- **Multiple menu styles** - Default, horizontal, vertical, and dropdown templates included
159167
- **Translation support** - Multilingual menu labels with locale-aware URLs
160168
- **Conditional visibility** - Show/hide menu items without deleting them
161169
- **Icon support** - Optional icons for menu items (basic implementation currently)
@@ -176,7 +184,7 @@ To make your models available in the menu builder, add them to the configuration
176184
],
177185
```
178186

179-
Your models should implement the `[HasMenuLabel](src/Models/Contracts/HasMenuLabel.php)` contract and the [HasTitleMenuLabelTrait](src/Models/Concerns/HasTitleMenuLabelTrait.php) trait:
187+
Your models should implement the `[HasMenuLabel](src/Models/Contracts/HasMenuLabel.php)` contract and the [HasMenuItemTrait](src/Models/Concerns/HasMenuItemTrait.php) trait:
180188

181189
```php
182190
use Statikbe\FilamentFlexibleContentBlockPages\Models\Contracts\HasMenuLabel;
@@ -215,7 +223,7 @@ See the file `../tailwind/components/menu/default.blade.php` for all possible at
215223

216224
### Customizing additional menu styles
217225

218-
If needed, you can easily add your own menu styles in addition to the `default` style:
226+
If needed, you can easily add your own menu styles in addition to the `default` style, e.g. the 'mega' menu style:
219227

220228
1. **Add new styles to config:**
221229
```php
@@ -245,20 +253,97 @@ resources/views/vendor/filament-flexible-content-block-pages/tailwind/components
245253

246254
The style can also be configured in the database model, then you can skip the `style` attribute.
247255

256+
### Menu seeding
257+
258+
It makes a lot of sense to create most of the menu's in seeders, so they can be automatically synced over different environments.
248259
See the [menu seeding documentation](documentation/seeders.md) for programmatic menu creation.
249260

250261
## Settings
251262

252-
TODO how to add settings in model and resource
263+
All settings are stored in one table in one record. The reason is to be able to add spatie medialibrary media as a config value.
264+
265+
### Use settings
266+
267+
Access settings values using helper functions or static methods:
268+
269+
```php
270+
use Statikbe\FilamentFlexibleContentBlockPages\Models\Settings;
271+
272+
// Helper functions (recommended)
273+
$siteTitle = flexiblePagesSetting(Settings::SETTING_SITE_TITLE);
274+
$contactInfo = flexiblePagesSetting(Settings::SETTING_CONTACT_INFO, 'en', '[email protected]');
275+
$seoImageUrl = flexiblePagesSettingImageUrl(Settings::COLLECTION_DEFAULT_SEO, Settings::CONVERSION_DEFAULT_SEO);
276+
277+
// Static methods
278+
$siteTitle = Settings::setting(Settings::SETTING_SITE_TITLE);
279+
$seoImageHtml = Settings::imageHtml(Settings::COLLECTION_DEFAULT_SEO, Settings::CONVERSION_DEFAULT_SEO);
280+
$settings = Settings::getSettings();
281+
```
282+
283+
### Extend settings
284+
285+
To add custom settings fields:
286+
287+
1. **Create a migration** to add new columns:
288+
```php
289+
Schema::table(FilamentFlexibleContentBlockPages::config()->getSettingsTable(), function (Blueprint $table) {
290+
$table->string('custom_field')->nullable();
291+
$table->json('translatable_field')->nullable(); // for translatable fields
292+
});
293+
```
294+
295+
2. **Extend the Settings model** by adding constants for easy referral and updating `$translatable`, if needed:
296+
```php
297+
class CustomSettings extends \Statikbe\FilamentFlexibleContentBlockPages\Models\Settings
298+
{
299+
const SETTING_CUSTOM_FIELD = 'custom_field';
300+
301+
protected $translatable = [
302+
parent::SETTING_FOOTER_COPYRIGHT,
303+
parent::SETTING_CONTACT_INFO,
304+
self::SETTING_CUSTOM_FIELD, // if translatable
305+
];
306+
}
307+
```
308+
309+
3. **Extend the SettingsResource** by overriding `getExtraFormTabs()`:
310+
```php
311+
class CustomSettingsResource extends \Statikbe\FilamentFlexibleContentBlockPages\Resources\SettingsResource
312+
{
313+
protected static function getExtraFormTabs(): array
314+
{
315+
return [
316+
Tab::make('Custom Tab')->schema([
317+
TextInput::make(CustomSettings::SETTING_CUSTOM_FIELD)
318+
->label('Custom Field')
319+
->required(),
320+
]),
321+
];
322+
}
323+
}
324+
```
325+
326+
4. **Configure the extended model and resource** in your config file:
327+
```php
328+
// config/filament-flexible-content-block-pages.php
329+
'models' => [
330+
// ...
331+
'settings' => \App\Models\CustomSettings::class,
332+
],
333+
334+
'resources' => [
335+
// ...
336+
'settings' => \App\Resources\CustomSettingsResource::class,
337+
],
338+
```
253339

254340
## Redirects
255341

256342
The package includes automatic redirect management: when the slug of a page changes, a redirect from the old page
257343
to the new page is added. These redirects are stored in the database and are managable with the Filament resource,
258-
so you can add your own redirects.
344+
so you can add your own redirects. For example, you can add handy redirects for marketing campaigns.
259345

260-
Additionally, we integrated [spatie/laravel-missing-page-redirector](https://github.com/spatie/laravel-missing-page-redirector),
261-
so you can easily configure other redirects in the spatie packages config.
346+
We have integrated [spatie/laravel-missing-page-redirector](https://github.com/spatie/laravel-missing-page-redirector), so you can easily configure other redirects in the spatie packages config.
262347

263348
### Configuration
264349

@@ -327,6 +412,7 @@ Enable and configure the sitemap generator in your config file:
327412
- Crawls your website to discover URLs
328413
- May find URLs not in your database
329414
- Slower but comprehensive
415+
- Requires chromium
330416

331417
**Hybrid** (`SitemapGeneratorMethod::HYBRID`):
332418
- Combines both approaches
@@ -424,6 +510,10 @@ Then update your configuration to use your custom service:
424510

425511
You can override any protected method to customize the sitemap generation behavior, including priority calculation, change frequency, URL filtering, or adding entirely new content types.
426512

513+
## Authorisation
514+
515+
TODO handle in project
516+
427517
## Configuration
428518

429519
TODO
@@ -438,7 +528,6 @@ check:
438528
menu:
439529
- caching tree model + observer to clear cache
440530
- Menu titels menu items
441-
- test global search and improve table search and ordering
442531

443532
page:
444533
- laravel scout
@@ -450,9 +539,6 @@ release:
450539
- documentation
451540
- Kristof: screenshots + banner + packagist + slack + filament plugin store
452541

453-
tags:
454-
- check doubles in tag field
455-
456542
future:
457543
- A simple asset manager (include or not?)
458544
- Re-usable content blocks
@@ -475,6 +561,16 @@ Please review [our security policy](../../security/policy) on how to report secu
475561
- [Sten Govaerts](https://github.com/sten)
476562
- [All Contributors](../../contributors)
477563

564+
We built this on the shoulders of others by combining several Laravel packages into a cohesive CMS solution, making it opinionated.
565+
We would like to thank the developers and contributors of the following packages:
566+
567+
- [artesaos/seotools](https://github.com/artesaos/seotools)
568+
- [guava/filament-icon-picker](https://github.com/lukas-frey/filament-icon-picker)
569+
- [mcamara/laravel-localization](https://github.com/mcamara/laravel-localization)
570+
- [solution-forest/filament-tree](https://github.com/solutionforest/filament-tree)
571+
- [spatie/laravel-missing-page-redirector](https://github.com/spatie/laravel-missing-page-redirector)
572+
- [spatie/laravel-sitemap](https://github.com/spatie/laravel-sitemap)
573+
478574
## License
479575

480576
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

documentation/configuration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Configuration
2+
3+
In this document, we explain all settings available in the [filament-flexible-content-block-pages configuration file](../config/filament-flexible-content-block-pages.php).
4+

0 commit comments

Comments
 (0)