Factory Action
CommunityThis adds a new action to the Filament admin panel table, enabling easy generation of test records for your database tables using your Laravel Factory definitions.
Author:
CodeWithDennis
Package health
BetaAutomated checks of this plugin's Composer package
1 checks
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Documentation
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.
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
#Installation
You can install the package via composer:
composer require codewithdennis/filament-factory-action
#Usage Example
Prior to utilizing this action, it is essential to ensure that you have set up a factory for your model.
class ProfileFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->company(),
'is_public' => rand(0, 1),
];
}
}
Suppose you already possess a ProfileResource within the Filament framework. You can integrate the action into the ListProfiles class, as demonstrated in the following example.
FactoryAction::make(),
use App\Filament\Resources\ProfileResource;
use CodeWithDennis\FactoryAction\FactoryAction;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListProfiles extends ListRecords
{
protected static string $resource = ProfileResource::class;
protected function getHeaderActions(): array
{
return [
FactoryAction::make()
->color('danger')
// ->slideOver()
->icon('heroicon-o-wrench'),
Actions\CreateAction::make()
];
}
}
You can create/attach relational records with the following example. Just make certain that these models also possess their respective factories
protected function getHeaderActions(): array
{
return [
FactoryAction::make()
// If you want to create or create and attach you can do so using `hasMany`
->hasMany([Badge::class, Category::class])
// If you want to attach existing models you can do so using `belongsToMany`
->belongsToMany([Badge::class, Category::class]),
];
}
The default behavior is to hide the action in production environments, but you can override this by using your own logic:
->hidden(fn() => false)
#Showcase
#Contributing
Please see CONTRIBUTING for details.
#Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
#Credits
#License
The MIT License (MIT). Please see License File for more information.
The author
I build Laravel & FilamentPHP plugins, tinker with code, and game way too much when I’m off the clock.
From the same author
Advanced Choice
A beautifully styled, fully customizable set of radio group components for FilamentPHP.
Author:
CodeWithDennis
Advanced Components
This plugin extends existing FilamentPHP components with advanced features and enhanced functionality.
Author:
CodeWithDennis
Larament
Kickstart your project and save time with Larament! This time-saving starter kit includes a Laravel project with FilamentPHP already installed and set up, along with extra features.
Author:
CodeWithDennis
Theme Inspector
Easily see the fi- class of any element on the page by hovering over it. A tooltip displays the class name, and you can copy it with a click!
Author:
CodeWithDennis
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese
Data Lens
Advanced Data Visualization for Laravel Filament - a premium reporting solution enabling custom column creation, sophisticated filtering, and enterprise-grade data insights within admin panels.
Padmission