Stars: 104
Forks: 14
Pull Requests: 27
Issues: 7
Watchers: 3
Last Updated: 2023-09-13 13:25:13
Plugin for Filament Panels that adds a dropdown menu to the header to quickly create new items.
License: MIT License
Languages: Blade, PHP
Plugin for Filament Admin Panel that adds a dropdown menu to the header to quickly create new items from anywhere in your app.
Install the package via composer
composer require awcodes/filament-quick-create
In an effort to align with Filament's theming methodology you will need to use a custom theme to use this plugin.
octicon-info mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true">
If you have not set up a custom theme and are using a Panel follow the instructions in the Filament Docs first. The following applies to both the Panels Package and the standalone Forms package.
Add the plugin's views to your tailwind.config.js
file.
content: [
'<path-to-vendor>/awcodes/filament-quick-create/resources/**/*.blade.php',
]
By default, Quick Create will use all resources that are registered with current Filament context. All resources will follow the authorization used by Filament, meaning that if a user doesn't have permission to create a record it will not be listed in the dropdown.
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
QuickCreatePlugin::make(),
])
}
octicon-alert mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true">
Excludes and includes are not meant to work together. You should use one or the other, but not both.
Excluding resources will filter them out of the registered resources to prevent them from displaying in the dropdown.
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
QuickCreatePlugin::make()
->excludes([
\App\Filament\Resources\UserResource::class,
]),
])
}
Sometimes, it might be easier to only include some resources instead of filtering them out. For instance, you have 30 resources but only want to display 3 to 4 in the dropdown.
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
QuickCreatePlugin::make()
->includes([
\App\Filament\Resources\UserResource::class,
]),
])
}
By default, Quick Create will sort all the displayed options in descending order. This can be disabled should you choose. In which case they will be displayed in the order they are registered with Filament.
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
QuickCreatePlugin::make()
->sort(false),
])
}
By default, Quick Create will render simple resources in a standard modal. If you would like to render them in a slide over instead you may use the slideOver()
modifier to do so.
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
QuickCreatePlugin::make()
->slideOver(),
])
}