awcodes/filament-quick-create
Adds a Quick Create dropdown to Filament Panels so users can create new records from anywhere. Automatically lists authorized resources in the current panel, with options to include or exclude specific resources. Compatible with Filament v2–v5.
Installation:
composer require awcodes/filament-quick-create
Ensure you have a custom Filament theme and add the plugin's views to your theme CSS:
@source '../../../../vendor/awcodes/filament-quick-create/resources/**/*.blade.php';
Register the Plugin:
Add the plugin to your Panel configuration in app/Providers/Filament/AdminPanelProvider.php:
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
QuickCreatePlugin::make(),
]);
}
First Use Case: Navigate to your Filament admin panel. A new dropdown button (default: "+ New") will appear in the header, listing all resources where the current user has create permissions. Clicking an item opens the resource's create form (modal or redirect, depending on the resource).
Resource Filtering:
QuickCreatePlugin::make()->excludes([UserResource::class])
QuickCreatePlugin::make()->includes([PostResource::class, ProductResource::class])
excludes or includes, not both.Sorting Options:
QuickCreatePlugin::make()->sort(false)
QuickCreatePlugin::make()->sortBy('navigation')
UI Customization:
QuickCreatePlugin::make()->rounded(false)
QuickCreatePlugin::make()->label('Create New')
QuickCreatePlugin::make()->hiddenIcons()
QuickCreatePlugin::make()->alwaysShowModal()
QuickCreatePlugin::make()->slideOver()
Conditional Visibility: Hide the plugin dynamically (e.g., during onboarding):
QuickCreatePlugin::make()->hidden(fn() => Filament::getTenant()->requiresOnboarding())
Keyboard Shortcuts: Add global shortcuts to trigger the dropdown:
QuickCreatePlugin::make()->keyBindings(['command+shift+a', 'ctrl+shift+a'])
Custom Render Hook: Change where the plugin renders (e.g., in the sidebar):
QuickCreatePlugin::make()->renderUsingHook(PanelsRenderHook::SIDEBAR_NAV_END)
"Create Another" Behavior: Override the default "create another" action for all resources:
QuickCreatePlugin::make()->createAnother(false) // Disable globally
Resource-Specific Overrides:
If a resource has a custom createAnother() method in its CreateAction, QuickCreate respects it by default. Use createAnother(false) to disable it globally if needed.
Localization:
The plugin supports translations (e.g., ckb for keyboard shortcuts). Ensure your Filament locale files include the plugin's translation keys.
Testing:
create permission should appear.Performance:
includes() to limit the dropdown size.Multi-Tenant Apps:
Use the hidden() callback to conditionally disable QuickCreate for tenants (e.g., during setup):
->hidden(fn() => Filament::getTenant()->isIncomplete())
Theme Dependency:
@source directive to your theme CSS will break the dropdown.@source '../../../../vendor/awcodes/filament-quick-create/resources/**/*.blade.php';
Resource Registration Timing:
booted() methods or lazy-load resources.Authorization Caching:
php artisan filament:cache-reset if needed.Modal Customization Conflicts:
extraModalAttributes) may conflict with QuickCreate’s defaults.extraModalAttributes method to override:
QuickCreatePlugin::make()->extraModalAttributes(['max-width' => '800px'])
Keyboard Shortcut Conflicts:
command+shift+a might conflict with browser/OS defaults.ctrl+alt+n).Resource Label Fallbacks:
getTitle() method returns null, the dropdown may display [object] or break.getTitle() properly or override the label in QuickCreate:
QuickCreatePlugin::make()->customLabels([
UserResource::class => 'Users',
]);
Log Resource Detection: Add temporary logging to verify which resources are being detected:
QuickCreatePlugin::make()->registerUsing(function (QuickCreatePlugin $plugin) {
\Log::info('Registered resources:', $plugin->getResources());
});
Inspect Render Hooks: If the plugin isn’t appearing, check the render hook:
QuickCreatePlugin::make()->renderUsingHook(PanelsRenderHook::HEADER_END);
Verify the hook exists in Filament’s docs.
Clear Caches: After making changes, run:
php artisan optimize:clear
php artisan view:clear
Check for JavaScript Errors:
Open browser dev tools (F12) and inspect the console for errors when clicking the dropdown or using shortcuts.
Customize the Dropdown Menu: Override the default Blade view by publishing the plugin’s views:
php artisan vendor:publish --tag="filament-quick-create-views"
Then modify resources/views/vendor/filament-quick-create/....
Dynamic Resource Filtering: Extend the plugin to filter resources dynamically (e.g., by tenant or role):
QuickCreatePlugin::make()->filterResources(function (array $resources) {
return collect($resources)->reject(fn($resource) => $resource instanceof AdminResource);
});
Add Custom Actions: Extend the dropdown to include non-resource actions (e.g., "Import Data"):
QuickCreatePlugin::make()->customActions([
'import' => [
'label' => 'Import',
'icon' => 'heroicon-o-upload',
'url' => route('filament.admin.resources.import.create'),
],
]);
Hook into Create Events: Listen for when a resource is created via QuickCreate:
QuickCreatePlugin::make()->created(function ($record) {
\Log::info("Created {$record->getModel()->getMorphClass()} via QuickCreate");
});
Localize Shortcuts: Override the default shortcuts for specific locales:
QuickCreatePlugin::make()->keyBindings([
'command+shift+a', // Default
'ctrl+shift+n', // Fallback for non-Mac users
]);
How can I help you explore Laravel packages today?