Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

ElevatoDigital/nova-attach-many

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nova Attach Many

Latest Version on Github Total Downloads Twitter Follow

Belongs To Many create & edit form UI for Nova. Enables attaching relationships easily and includes validation.

attach-many

Installation

composer require dillingham/nova-attach-many

Usage

use NovaAttachMany\AttachMany;
public function fields(Request $request)
{
    return [
        AttachMany::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"
  • ->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

Thanks

dkulyk helped with authorization

About

BelongsToMany create / edit form component for Nova

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vue 50.2%
  • PHP 48.5%
  • JavaScript 1.3%