PHP code example of tschucki / filament-workflows

1. Go to this page and download the library: Download tschucki/filament-workflows 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/ */

    

tschucki / filament-workflows example snippets


use Tschucki\FilamentWorkflows\FilamentWorkflowsPlugin;

->plugins([
    FilamentWorkflowsPlugin::make()
])

use Tschucki\FilamentWorkflows\Concerns\InteractsWithWorkflow;

class User extends Model {
  use InteractsWithWorkflow;
}



namespace App\Jobs\WorkflowActions;

use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Tschucki\FilamentWorkflows\WorkflowActions\BaseAction;

class TestAction extends BaseAction
{
    public User $user;

    public function __construct(User $user)
    {
        $this->user = $user;
    }

    public function handle(): void
    {
        \Log::info($this->user->name . ' was created at ' . $this->user->created_at);
    }
    
    // Will be later used in the Logs (coming soon) 
    public function getActionName(): string
    {
        return 'Der Hackfleisch hassender Zerhacker';
    }

    public function getActionDescription(): string
    {
        return 'Schneidet Kopfsalat. Und das nachts :)';
    }

    public function getActionCategory(): string
    {
        return 'Default-Category';
    }

    public function getActionIcon(): string
    {
        return 'heroicon-o-adjustments';
    }
}

    public function getTitleColumnForWorkflowSearch(): ?string
    {
        return 'name';
    }



return [
    'search' => [
        'max_results' => 100,
    ]
];
bash
php artisan filament-workflows:install
bash
php artisan vendor:publish --tag="filament-workflows-migrations"
php artisan migrate