{"id":24012843,"url":"https://github.com/tschucki/filament-workflows","last_synced_at":"2025-04-15T08:36:51.512Z","repository":{"id":219510037,"uuid":"749214396","full_name":"Tschucki/filament-workflows","owner":"Tschucki","description":"Laravel Filament plugin to add workflows.  Attach triggers and dispatchable actions to automate tasks","archived":false,"fork":false,"pushed_at":"2025-02-03T14:36:16.000Z","size":200,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-14T19:43:37.636Z","etag":null,"topics":["automation","filament-plugin","filamentphp","laravel","plugin","workflows"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tschucki.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Tschucki"}},"created_at":"2024-01-27T22:37:42.000Z","updated_at":"2025-03-21T03:24:14.000Z","dependencies_parsed_at":"2024-01-28T01:24:03.625Z","dependency_job_id":"7688dcc9-8d99-40a4-a8aa-243203215d9c","html_url":"https://github.com/Tschucki/filament-workflows","commit_stats":null,"previous_names":["tschucki/filament-workflows"],"tags_count":5,"template":false,"template_full_name":"filamentphp/plugin-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tschucki%2Ffilament-workflows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tschucki%2Ffilament-workflows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tschucki%2Ffilament-workflows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tschucki%2Ffilament-workflows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tschucki","download_url":"https://codeload.github.com/Tschucki/filament-workflows/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249038390,"owners_count":21202690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","filament-plugin","filamentphp","laravel","plugin","workflows"],"created_at":"2025-01-08T06:22:02.077Z","updated_at":"2025-04-15T08:36:51.492Z","avatar_url":"https://github.com/Tschucki.png","language":"PHP","funding_links":["https://github.com/sponsors/Tschucki"],"categories":[],"sub_categories":[],"readme":"# Add workflows to your filament app\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/tschucki/filament-workflows.svg?style=flat-square)](https://packagist.org/packages/tschucki/filament-workflows)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/tschucki/filament-workflows/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/tschucki/filament-workflows/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![Fix PHP Code Styling](https://github.com/Tschucki/filament-workflows/actions/workflows/fix-php-code-styling.yml/badge.svg)](https://github.com/Tschucki/filament-workflows/actions/workflows/fix-php-code-styling.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/tschucki/filament-workflows.svg?style=flat-square)](https://packagist.org/packages/tschucki/filament-workflows)\n\nThis plugin lets you add workflows to your filament app. You can attach triggers and dispatchable actions to your\nworkflows. The plugin will automatically execute the actions when the trigger conditions are met.\n\n## Table of Contents\n\n- [Images](#images)\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Basics](#basics)\n    - [Add the trait to your model](#add-the-trait-to-your-model)\n    - [Create an Action](#create-an-action)\n- [Configuration](#configuration)\n    - [Define searchable field](#define-searchable-field)\n    - [Max Search Results](#max-search-results)\n- [Testing](#testing)\n- [Changelog](#changelog)\n- [Contributing](#contributing)\n- [Security Vulnerabilities](#security-vulnerabilities)\n- [Credits](#credits)\n- [License](#license)\n\n## Images\n\n![Screenshot 1](.github/images/Basic-Form.png)\n![Screenshot 2](.github/images/Trigger-Form.png)\n![Screenshot 3](.github/images/Actions-Form.png)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require tschucki/filament-workflows\n```\n\nYou can install the plugin using:\n\n```bash\nphp artisan filament-workflows:install\n```\n\nYou can publish and run the migrations manually with:\n\n```bash\nphp artisan vendor:publish --tag=\"filament-workflows-migrations\"\nphp artisan migrate\n```\n\nRegister the plugin in your `AdminPanelServiceProvider`:\n\n```php\nuse Tschucki\\FilamentWorkflows\\FilamentWorkflowsPlugin;\n\n-\u003eplugins([\n    FilamentWorkflowsPlugin::make()\n])\n```\n\n## Usage\n### Basics\nIn order to let your models use workflows, you need to add the `InteractsWithWorkflows` trait to your model. By adding this trait, the plugin will automatically add a global observer to your model. So when ever a workflow matches the event and trigger conditions, the workflow will execute the actions.\n\n### Add the trait to your model\n```php\nuse Tschucki\\FilamentWorkflows\\Concerns\\InteractsWithWorkflow;\n\nclass User extends Model {\n  use InteractsWithWorkflow;\n}\n```\n\n### Create an Action\nIn order to attach an action to your workflows, you will have to create a class within the `App\\Jobs\\Actions` folder. The class must extend the `BaseAction` class. This requires you to implement the `handle` method. This method will be called when the workflow is executed.\n\nThe action class is very similar to a job.\nWhen ever the action get executed, the model will be passed to the `__construct` method. You can use the model to do whatever you want.\n\nThe plugin will find this class on its own. So you don't have to register it anywhere.\n\n```php\n\u003c?php\n\nnamespace App\\Jobs\\WorkflowActions;\n\nuse App\\Models\\User;\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Tschucki\\FilamentWorkflows\\WorkflowActions\\BaseAction;\n\nclass TestAction extends BaseAction\n{\n    public User $user;\n\n    public function __construct(User $user)\n    {\n        $this-\u003euser = $user;\n    }\n\n    public function handle(): void\n    {\n        \\Log::info($this-\u003euser-\u003ename . ' was created at ' . $this-\u003euser-\u003ecreated_at);\n    }\n    \n    // Will be later used in the Logs (coming soon) \n    public function getActionName(): string\n    {\n        return 'Der Hackfleisch hassender Zerhacker';\n    }\n\n    public function getActionDescription(): string\n    {\n        return 'Schneidet Kopfsalat. Und das nachts :)';\n    }\n\n    public function getActionCategory(): string\n    {\n        return 'Default-Category';\n    }\n\n    public function getActionIcon(): string\n    {\n        return 'heroicon-o-adjustments';\n    }\n}\n```\n\nThat's it. Now you can create and attach actions to your workflows.\n\n## Configuration\n\n### Define searchable field\n\nIf you don't just want to search for the `id`, you can use the function `getTitleColumnForWorkflowSearch` within your model to search in another field as well.\n\n```php\n    public function getTitleColumnForWorkflowSearch(): ?string\n    {\n        return 'name';\n    }\n```\n\n### Max Search Results\nIn case you want to change the max search results for the models, you can publish the config file and change the `workflows.search.max_results` value (defaults to 100).\nThis can come in handy when you have a lot of models and the search is slow.\n\n```php\n\u003c?php\n\nreturn [\n    'search' =\u003e [\n        'max_results' =\u003e 100,\n    ]\n];\n```\n\n### Use Custom Models and Resources\nIf you want to use custom models and resources, you can publish the config file and change the `workflows.models` and `workflows.resources` values. It is highly recommended that custom models and resources extend the existing Workflow classes.\n\n```php\n\u003c?php\n\nreturn [\n    'models' =\u003e [\n        'workflow' =\u003e \\Tschucki\\FilamentWorkflows\\Models\\WorkflowLog::class,\n        'workflow_log' =\u003e \\Tschucki\\FilamentWorkflows\\Models\\WorkflowLog::class,\n    ],\n    'resources' =\u003e [\n        'workflow' =\u003e \\Tschucki\\FilamentWorkflows\\Resources\\FilamentWorkflowResource::class,\n    ],\n];\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Marcel Wagner](https://github.com/Tschucki)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftschucki%2Ffilament-workflows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftschucki%2Ffilament-workflows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftschucki%2Ffilament-workflows/lists"}