Generate a complete FilamentPHP v4 resource with form schema, table config, relation managers, and Pest tests
Generate a complete FilamentPHP v4 resource with form schema, table config, relation managers, and Pest tests. Use --generate to auto-detect fields from model, --simple for modal forms, --soft-deletes, or --view for read-only.
/plugin marketplace add mwguerra/claude-code-plugins/plugin install post-development@mwguerra-marketplace<ModelName> [--generate] [--simple] [--soft-deletes] [--view]Create a complete FilamentPHP v4 resource including form schema, table configuration, relation managers, and Pest tests.
# Basic resource
/filament:resource Post
# Generate from model (auto-detect fields)
/filament:resource Post --generate
# Simple resource (modal forms)
/filament:resource Post --simple
# With soft deletes support
/filament:resource Post --soft-deletes
# View-only resource
/filament:resource Post --view
Before generating any code, read the relevant documentation:
/home/mwguerra/projects/mwguerra/claude-code-plugins/filament-specialist/skills/filament-docs/references/general/03-resources/ for resource patterns/home/mwguerra/projects/mwguerra/claude-code-plugins/filament-specialist/skills/filament-docs/references/forms/ for form fields/home/mwguerra/projects/mwguerra/claude-code-plugins/filament-specialist/skills/filament-docs/references/tables/ for table columnsIf the model exists:
Use artisan to create the resource:
php artisan make:filament-resource ModelName [flags]
Based on model analysis:
Based on model analysis:
For each hasMany or belongsToMany relationship:
php artisan make:filament-relation-manager ResourceName RelationName column_name
Create comprehensive Pest tests for:
Generated files:
app/Filament/Resources/{Model}Resource.phpapp/Filament/Resources/{Model}Resource/Pages/List{Models}.phpapp/Filament/Resources/{Model}Resource/Pages/Create{Model}.phpapp/Filament/Resources/{Model}Resource/Pages/Edit{Model}.phpapp/Filament/Resources/{Model}Resource/Pages/View{Model}.php (if --view)app/Filament/Resources/{Model}Resource/RelationManagers/* (if relations)tests/Feature/Filament/{Model}ResourceTest.phpFor /filament:resource Post:
// app/Filament/Resources/PostResource.php
<?php
declare(strict_types=1);
namespace App\Filament\Resources;
use App\Filament\Resources\PostResource\Pages;
use App\Filament\Resources\PostResource\RelationManagers;
use App\Models\Post;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
class PostResource extends Resource
{
protected static ?string $model = Post::class;
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static ?string $navigationGroup = 'Content';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make('Post Details')
->schema([
Forms\Components\TextInput::make('title')
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(fn ($state, $set) =>
$set('slug', \Str::slug($state))),
Forms\Components\TextInput::make('slug')
->required()
->unique(ignoreRecord: true),
Forms\Components\Select::make('author_id')
->relationship('author', 'name')
->searchable()
->preload()
->required(),
Forms\Components\Select::make('category_id')
->relationship('category', 'name')
->searchable()
->preload(),
])
->columns(2),
Forms\Components\Section::make('Content')
->schema([
Forms\Components\RichEditor::make('content')
->required()
->columnSpanFull(),
]),
Forms\Components\Section::make('Publishing')
->schema([
Forms\Components\Select::make('status')
->options([
'draft' => 'Draft',
'published' => 'Published',
])
->default('draft')
->required(),
Forms\Components\DateTimePicker::make('published_at'),
Forms\Components\Toggle::make('is_featured')
->default(false),
])
->columns(3),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('title')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('author.name')
->sortable(),
Tables\Columns\BadgeColumn::make('status')
->colors([
'warning' => 'draft',
'success' => 'published',
]),
Tables\Columns\IconColumn::make('is_featured')
->boolean(),
Tables\Columns\TextColumn::make('published_at')
->dateTime()
->sortable(),
])
->filters([
Tables\Filters\SelectFilter::make('status')
->options([
'draft' => 'Draft',
'published' => 'Published',
]),
Tables\Filters\SelectFilter::make('author')
->relationship('author', 'name'),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
RelationManagers\CommentsRelationManager::class,
RelationManagers\TagsRelationManager::class,
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListPosts::route('/'),
'create' => Pages\CreatePost::route('/create'),
'view' => Pages\ViewPost::route('/{record}'),
'edit' => Pages\EditPost::route('/{record}/edit'),
];
}
}