guava / filament-modal-relation-managers
Allows you to embed relation managers inside filament modals.
Fund package maintenance!
GuavaCZ
Installs: 1 021
Dependents: 0
Suggesters: 0
Security: 0
Stars: 40
Watchers: 1
Forks: 5
Open Issues: 0
Requires
- php: ^8.1
- filament/filament: ^3.2
- illuminate/contracts: ^10.0|^11.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8|^8.1
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.8|^9.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
Allows you to embed relation managers inside filament modals.
This package allows you to embed any of your relation managers inside modals using a provided filament action.
Showcase
demo_preview.mov
Support us
Your support is key to the continual advancement of our plugin. We appreciate every user who has contributed to our journey so far.
While our plugin is available for all to use, if you are utilizing it for commercial purposes and believe it adds significant value to your business, we kindly ask you to consider supporting us through GitHub Sponsors. This sponsorship will assist us in continuous development and maintenance to keep our plugin robust and up-to-date. Any amount you contribute will greatly help towards reaching our goals. Join us in making this plugin even better and driving further innovation.
Installation
You can install the package via composer:
composer require guava/filament-modal-relation-managers
Assets
Make sure you have a custom filament theme installed (more info in the official documentation here) and add the following to your theme's tailwind.config.js
content property, so that our CSS overrides are correctly built:
export default { //... content: [ // ... './vendor/guava/filament-modal-relation-managers/resources/**/*.blade.php', ] }
Usage
First, for any relation manager that you want to be able to embed inside modals, add the CanBeEmbeddedInModals
trait:
use Guava\FilamentModalRelationManagers\Concerns\CanBeEmbeddedInModals; class LessonsRelationManager extends RelationManager { use CanBeEmbeddedInModals; // ... }
And that's it! Now you can use the RelationManagerAction
anywhere you like to open the relation manager as a modal:
use Guava\FilamentModalRelationManagers\Actions\Table\RelationManagerAction; // for example in a resource table class CourseResource extends Resource { // ... public static function table(Table $table): Table { return $table ->actions([ RelationManagerAction::make('lesson-relation-manager') ->label('View lessons') ->relationManager(LessonRelationManager::make()), ]) // ... ; } // ... }
use Guava\FilamentModalRelationManagers\Actions\Infolist\RelationManagerAction; // for example in a resource infolist class CourseResource extends Resource { // ... public static function infolist(Infolist $infolist): Infolist { return $infolist ->schema([ TextEntry::make('title') ->suffixAction(RelationManagerAction::make() ->label('View lessons') ->relationManager(LessonRelationManager::make())) ]) // ... ; } // ... }
use Guava\FilamentModalRelationManagers\Actions\Action\RelationManagerAction; // for example in edit page class EditCourse extends EditRecord { // ... protected function getHeaderActions(): array { return [ RelationManagerAction::make() ->label('View lessons') ->record($this->getRecord()) ->relationManager(LessonRelationManager::make()) ]; } // ... }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Lukas Frey
- All Contributors
- Spatie - Our package skeleton is a modified version of Spatie's Package Skeleton
License
The MIT License (MIT). Please see License File for more information.