Skip to content

Commit e761271

Browse files
scott graysonscott grayson
authored andcommitted
Refactor: Remove unused code from old controller/view implementation
- Remove PublicHelpArticleController and related views - Remove HelpLayout component and public route views - Remove unused test files (PublicHelpArticleTest, PublicTestCase) - Remove empty Http directories - Update ViewHelpArticle to use guest panel resource URL - Remove CSS config option (now handled by Filament panel themes) - Update config to use frontend_slug and guest_slug instead of route_prefix
1 parent b8bfb46 commit e761271

File tree

20 files changed

+370
-692
lines changed

20 files changed

+370
-692
lines changed

README.md

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ return [
5757

5858
## Using the Plugins
5959

60-
### Admin Plugin
60+
### Admin Plugin (for editing help articles)
6161

62-
Add this plugin to a panel on `plugins()` method.
62+
Add this plugin to your admin panel for full CRUD operations.
6363
E.g. in `app/Providers/Filament/AdminPanelProvider.php`:
6464

6565
```php
@@ -76,9 +76,13 @@ public function panel(Panel $panel): Panel
7676
}
7777
```
7878

79-
### Frontend Plugin
79+
**Location**: Admin panel (typically `/admin/help-articles`)
80+
**Access**: Authenticated admin users only
81+
**Features**: Create, edit, delete, and manage all help articles
8082

81-
Add this plugin to a panel for frontend access:
83+
### Frontend Plugin (for authenticated users)
84+
85+
Add this plugin to your authenticated user panel for read-only access:
8286

8387
```php
8488
use Tapp\FilamentHelp\FilamentHelpFrontendPlugin;
@@ -88,16 +92,69 @@ public function panel(Panel $panel): Panel
8892
return $panel
8993
// ...
9094
->plugins([
91-
FilamentHelpFrontendPlugin::make(),
95+
FilamentHelpFrontendPlugin::make()
96+
->slug('app/help'), // Optional: customize the URL slug
9297
//...
9398
]);
9499
}
95100
```
96101

102+
**Configuration Options:**
103+
- **Plugin method**: `->slug('custom-slug')` - Set the URL slug when registering the plugin
104+
- **Config file**: `filament-help.frontend_slug` - Default slug (defaults to `'help'`)
105+
- **Environment variable**: `FILAMENT_HELP_FRONTEND_SLUG` - Override via `.env`
106+
107+
**Location**: App panel (defaults to `/help`, configurable)
108+
**Access**: Authenticated users only
109+
**Features**: Read-only access to public help articles
110+
111+
### Guest Plugin (for public access)
112+
113+
Add this plugin to a guest panel (without authentication) for public access:
114+
115+
```php
116+
use Tapp\FilamentHelp\FilamentHelpGuestPlugin;
117+
118+
public function panel(Panel $panel): Panel
119+
{
120+
return $panel
121+
->id('guest')
122+
->path('help') // Panel path
123+
// ... other panel configuration
124+
// Note: Do NOT add authMiddleware() for guest access
125+
->plugins([
126+
FilamentHelpGuestPlugin::make()
127+
->slug(''), // Optional: customize the URL slug (empty = use panel path)
128+
//...
129+
]);
130+
}
131+
```
132+
133+
**Configuration Options:**
134+
- **Plugin method**: `->slug('custom-slug')` - Set the URL slug when registering the plugin
135+
- **Config file**: `filament-help.guest_slug` - Default slug (defaults to `''` - empty string)
136+
- **Environment variable**: `FILAMENT_HELP_GUEST_SLUG` - Override via `.env`
137+
138+
**Location**: Guest panel (defaults to panel path, configurable)
139+
**Access**: Public (no authentication required)
140+
**Features**: Read-only access to public help articles for guests
141+
142+
**Note**: If you set the guest slug to an empty string (default), the help articles will be available directly at the panel path. For example, if your panel path is `help`, articles will be at `/help` and `/help/{slug}`.
143+
144+
## Help Article Locations
145+
146+
Help articles are available in three different locations depending on your setup:
147+
148+
1. **Admin Panel** (`/admin/help-articles`): For editing and managing help articles
149+
2. **App Panel** (configurable, default `/help`): For authenticated users to view public help articles
150+
3. **Guest Panel** (configurable, default uses panel path): For public/guest users to view public help articles
151+
152+
The frontend and guest panel URLs can be customized using the plugin's `->slug()` method or via configuration (see plugin documentation above).
153+
97154
## Features
98155

99156
- **Admin Panel**: Full CRUD operations for help articles
100-
- **Frontend**: Read-only access to public help articles
157+
- **Frontend/Guest**: Read-only access to public help articles
101158
- **Rich Content**: HTML content support with iframe embedding
102159
- **Public/Private**: Control article visibility
103160
- **Search & Filter**: Find articles by name and filter by public status

config/filament-help.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,28 @@
33
return [
44
/*
55
|--------------------------------------------------------------------------
6-
| Public Route Prefix
6+
| Frontend Help Slug
77
|--------------------------------------------------------------------------
88
|
9-
| The URL prefix for public unauthenticated help article routes.
10-
| Authenticated users are redirected to the Filament panel help resource.
9+
| The URL slug for authenticated user help articles in the frontend panel.
10+
| This can be overridden when registering the plugin using ->slug('custom-slug').
1111
|
12-
| Default: 'help-articles'
12+
| Default: 'help'
1313
|
1414
*/
15-
'route_prefix' => env('FILAMENT_HELP_ROUTE_PREFIX', 'help-articles'),
16-
15+
'frontend_slug' => env('FILAMENT_HELP_FRONTEND_SLUG', 'help'),
16+
1717
/*
1818
|--------------------------------------------------------------------------
19-
| CSS Files
19+
| Guest Help Slug
2020
|--------------------------------------------------------------------------
2121
|
22-
| CSS files to include in the help layout. The package CSS is always loaded
23-
| first, followed by your app CSS (Tailwind required) for additional styling.
24-
|
25-
| You can add multiple CSS files if needed, e.g.:
26-
| 'css' => ['resources/css/app.css', 'resources/css/custom.css']
22+
| The URL slug for guest/public help articles in the guest panel.
23+
| Set to empty string ('') to use the panel path directly.
24+
| This can be overridden when registering the plugin using ->slug('custom-slug').
2725
|
28-
| Default: ['resources/css/app.css']
26+
| Default: '' (empty - uses panel path)
2927
|
3028
*/
31-
'css' => ['resources/css/app.css'],
29+
'guest_slug' => env('FILAMENT_HELP_GUEST_SLUG', ''),
3230
];

resources/views/components/pagination.blade.php

Lines changed: 0 additions & 106 deletions
This file was deleted.

resources/views/layouts/help.blade.php

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)