1. Go to this page and download the library: Download packstub/filament-flow library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
packstub / filament-flow example snippets
use Packstub\Flow\Concerns\HasWorkflows;
class Order extends Model
{
use HasWorkflows;
}
use Packstub\Flow\FlowPlugin;
$panel->plugin(
FlowPlugin::make()
->navigationGroup('Automation'),
);
use Packstub\Flow\Filament\Forms\Components\FlowBuilder;
// The canvas is a form field — use it in your own resource if you like
FlowBuilder::make('definition')->minHeight('70vh')
use Packstub\Flow\Facades\Flow;
use Packstub\Flow\Nodes\Triggers\RecordUpdated;
Flow::dispatch(RecordUpdated::class, ['model' => $order]);
use Packstub\Flow\Facades\Flow;
// Continue every run waiting on this key along its "Received" output
Flow::signal('payment.42', ['paid_at' => now()]);
use Filament\Forms\Components\TextInput;
use Packstub\Flow\Nodes\Action;
use Packstub\Flow\Nodes\Concerns\InterpolatesPlaceholders;
class AssignToTeam extends Action
{
use InterpolatesPlaceholders;
public function getName(): string
{
return 'Assign to team';
}
public function getIcon(): ?string
{
return 'heroicon-o-user-group';
}
public function getFormSchema(): array
{
return [TextInput::make('team')->
use Packstub\Flow\FlowPlugin;
FlowPlugin::make()
->triggers([OrderPaid::class]) // add your own nodes
->actions([AssignToTeam::class])
->conditions([IsVip::class])
->without([SendSlackMessage::class]) // hide built-in nodes
->models([Order::class, Invoice::class]) // offered by the record triggers
->navigationGroup('Automation')
->navigationIcon('heroicon-o-bolt')
->navigationSort(10)
->resource(App\Filament\Resources\WorkflowResource::class) // or ->withoutResource()