Skip to content
Discussion options

You must be logged in to vote

Yep, that's the case where the shared base class really pays off. You write the logic once in a base class outside the panel-mapped directories, and each panel gets a tiny subclass. Like this:

Modules/Blog/
├── Support/
│   └── Filament/
│       └── BasePostResource.php    ← all the real logic lives here
└── Filament/
    ├── Admin/
    │   └── Resources/PostResource.php   → extends BasePostResource
    └── User/
        └── Resources/PostResource.php   → extends BasePostResource

The base class:

namespace Modules\Blog\Support\Filament;

use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use Modules\Blog\Models\Post;

abstract class BasePostResource e…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by HomaEEE
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants