manojo123 / nova-attach-pivot
Attach Pivot Nova field
Installs: 290
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 107
Open Issues: 0
Language:Vue
Requires
- php: >=7.1.0
README
- You can use attachPivot field with pivot Fields.
- You can search elements by custom fields instead only name
Nova Attach Pivot
Forked from Dillingham's REPO. Changed the name to avoid dependencies conflicts. I will be so grateful if someone can use this branch and finish the TODO list.
Belongs To Many create & edit form UI for Nova. Enables attaching relationships easily and includes validation.
Installation
composer require manojo123/nova-attach-pivot
Usage
use NovaAttachPivot\AttachPivot;
public function fields(Request $request) { return [ AttachPivot::make('Permissions'), ]; }
Validation
You can set min, max, size or custom rule objects
->rules('min:5', 'max:10', 'size:10', new CustomRule)
Options
Here are a few customization options
->showCounts()
Shows "selected/total"->pivotFields(['qty'])
Adds pivot fields to be attached inline->searchableFields(['bar_code'])
Search box can find by name plus all fields defined in this method->showPreview()
Shows only selected->hideToolbar()
Removes search & select all->height('500px')
Set custom height->fullWidth()
Set to full width->help('<b>Tip:</b> help text')
Set the help text
All Options Demo
Relatable
The attachable resources will be filtered by relatableQuery() So you can filter which resources are able to be attached
Authorization
This field also respects policies: ie Role / Permission
- RolePolicy: attachAnyPermission($user, $role)
- RolePolicy: attachPermission($user, $role, $permission)
- PermissionPolicy: viewAny($user)
TODO
[] Add pagination for large amount of resources [] Pass Nova Fields instead array of strings in pivotFields with full field framework customization. (Rules, Types, etc) [] Refactorate code and perform some unit tests.