Skip to content

Form

Now that you have Workflows ready to be used and Permissions configured for your users, you can configure your Filament resource to handle Workflow states.

State Form field

Let’s assume that you have a model Project that implement HasWorkflow interface, and a ProjectResource that define the Filament resource for this model.

If you want to handle Workflow states inside your resource form, you can use StateField inside the resource form definition:

<?php
namespace App\Filament\Resources;
use App\Filament\Resources\ProjectResource\Pages;
use App\Filament\Resources\ProjectResource\RelationManagers;
use App\Models\Project;
use Devaslanca\Fluent\Filament\Actions\Table\TransitionsActions;
use Devaslanca\Fluent\Forms\Components\StateField;
use Devaslanca\Fluent\Tables\Columns\StateSelectColumn;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
class ProjectResource extends Resource
{
protected static ?string $model = Project::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->required()
->maxLength(255),
StateField::init(), // <-
]);
}
}

This form field is based on Filament Select field so feel free to customize it as you like.