{"id":16461766,"url":"https://github.com/codewithdennis/filament-factory-action","last_synced_at":"2025-08-16T16:47:29.830Z","repository":{"id":199701181,"uuid":"703149071","full_name":"CodeWithDennis/filament-factory-action","owner":"CodeWithDennis","description":"This plugin adds a new feature to the Filament admin panel table, enabling easy generation of test records for your database tables using your Laravel Factory definitions.","archived":false,"fork":false,"pushed_at":"2025-03-19T07:41:23.000Z","size":50,"stargazers_count":35,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"3.x","last_synced_at":"2025-04-09T21:19:10.441Z","etag":null,"topics":[],"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/CodeWithDennis.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"CodeWithDennis"}},"created_at":"2023-10-10T17:27:28.000Z","updated_at":"2025-03-19T07:41:06.000Z","dependencies_parsed_at":"2023-10-11T20:21:01.069Z","dependency_job_id":"ea289e2b-d9d2-433a-9217-eb7f4b900d35","html_url":"https://github.com/CodeWithDennis/filament-factory-action","commit_stats":null,"previous_names":["codewithdennis/filament-factory-action"],"tags_count":4,"template":false,"template_full_name":"filamentphp/plugin-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithDennis%2Ffilament-factory-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithDennis%2Ffilament-factory-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithDennis%2Ffilament-factory-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithDennis%2Ffilament-factory-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeWithDennis","download_url":"https://codeload.github.com/CodeWithDennis/filament-factory-action/tar.gz/refs/heads/3.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111973,"owners_count":21049578,"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":[],"created_at":"2024-10-11T11:09:17.784Z","updated_at":"2025-04-09T21:19:16.620Z","avatar_url":"https://github.com/CodeWithDennis.png","language":"PHP","funding_links":["https://github.com/sponsors/CodeWithDennis"],"categories":["Plugins"],"sub_categories":["Administration \u0026 Management"],"readme":"# Filament Factory Action\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/codewithdennis/filament-factory-action.svg?style=flat-square)](https://packagist.org/packages/codewithdennis/filament-factory-action)\n[![Total Downloads](https://img.shields.io/packagist/dt/codewithdennis/filament-factory-action.svg?style=flat-square)](https://packagist.org/packages/codewithdennis/filament-factory-action)\n\n![Filament Factory Action](https://github.com/CodeWithDennis/filament-factory-action/assets/23448484/405e92b9-68f5-4983-9619-2ce00a56eeab)\n\n\nThis plugin adds a new feature to the Filament admin panel table, enabling easy generation of test records for your database tables using your Laravel Factory definitions.\n\n_This plugin extends the standard Filament action, ensuring that you can continue to utilize all the methods that are typically available within the action class_\n\n## Installation\nYou can install the package via composer:\n\n```bash\ncomposer require codewithdennis/filament-factory-action\n```\n\n## Usage Example\n\nPrior to utilizing this action, it is essential to ensure that you have set up a [factory](https://laravel.com/docs/10.x/eloquent-factories) for your model.\n\n```php\nclass ProfileFactory extends Factory\n{\n    public function definition(): array\n    {\n        return [\n            'name' =\u003e fake()-\u003ecompany(),\n            'is_public' =\u003e rand(0, 1),\n        ];\n    }\n}\n````\n\nSuppose you already possess a `ProfileResource` within the Filament framework. You can integrate the action into the ListProfiles class, as demonstrated in the following example.\n\n```php\nFactoryAction::make(),\n```\n\n```PHP\nuse App\\Filament\\Resources\\ProfileResource;\nuse CodeWithDennis\\FactoryAction\\FactoryAction;\nuse Filament\\Actions;\nuse Filament\\Resources\\Pages\\ListRecords;\n\nclass ListProfiles extends ListRecords\n{\n    protected static string $resource = ProfileResource::class;\n\n    protected function getHeaderActions(): array\n    {\n        return [\n            FactoryAction::make()\n                -\u003ecolor('danger')\n                // -\u003eslideOver()\n                -\u003eicon('heroicon-o-wrench'),\n            Actions\\CreateAction::make()\n        ];\n    }\n}\n```\n\nYou can create/attach relational records with the following example. Just make certain that these models also possess their respective factories\n\n```PHP\nprotected function getHeaderActions(): array\n{\n    return [\n        FactoryAction::make()\n            // If you want to create or create and attach you can do so using `hasMany`\n            -\u003ehasMany([Badge::class, Category::class])\n            // If you want to attach existing models you can do so using `belongsToMany`\n            -\u003ebelongsToMany([Badge::class, Category::class]),\n    ];\n}\n```\n\nThe default behavior is to hide the action in production environments, but you can override this by using your own logic:\n\n```php\n-\u003ehidden(fn() =\u003e false)\n```\n\n## Showcase\n\u003cimg width=\"1420\" alt=\"example-1\" src=\"https://github.com/CodeWithDennis/filament-factory-action/assets/23448484/a4d6a785-977e-4c3c-ad03-96ee06bd3c06\"\u003e\n\u003cimg width=\"1399\" alt=\"example-2\" src=\"https://github.com/CodeWithDennis/filament-factory-action/assets/23448484/8eab103c-4ef3-4563-9202-afcb88d17ad2\"\u003e\n\u003cimg width=\"1023\" alt=\"example-3\" src=\"https://github.com/CodeWithDennis/filament-factory-action/assets/23448484/7772fbf3-f708-4d24-bc50-84334615b18f\"\u003e\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- [CodeWithDennis](https://github.com/CodeWithDennis)\n- [Adam Weston](https://github.com/awcodes)\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%2Fcodewithdennis%2Ffilament-factory-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithdennis%2Ffilament-factory-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithdennis%2Ffilament-factory-action/lists"}