All Projects → dillingham → Nova Attach Many

dillingham / Nova Attach Many

Licence: mit
BelongsToMany create / edit form component for Nova

Labels

Projects that are alternatives of or similar to Nova Attach Many

Laravel Http2 Server Push
A middleware package for Laravel to enable server push for your script, style, and image assets.
Stars: ✭ 174 (-2.79%)
Mutual labels:  laravel
Laravel Beanstalkd Admin Ui
An Admin UI for Beanstalkd and Laravel
Stars: ✭ 176 (-1.68%)
Mutual labels:  laravel
Blade Heroicons
A package to easily make use of Heroicons in your Laravel Blade views.
Stars: ✭ 173 (-3.35%)
Mutual labels:  laravel
Rating
Laravel Eloquent Rating allows you to assign ratings to any model.
Stars: ✭ 175 (-2.23%)
Mutual labels:  laravel
Eloquent Filter
The Eloquent Filter is a package for filter data of models by the query string. Easy to use and fully dynamic.
Stars: ✭ 175 (-2.23%)
Mutual labels:  laravel
Php Examples For Aws Lambda
Demo serverless applications, examples code snippets and resources for PHP
Stars: ✭ 177 (-1.12%)
Mutual labels:  laravel
Laravel Messenger
Simple user messaging package for Laravel
Stars: ✭ 2,140 (+1095.53%)
Mutual labels:  laravel
Platform
A @laravel based RAD platform for back-office applications, admin/user panels, and dashboards.
Stars: ✭ 2,623 (+1365.36%)
Mutual labels:  laravel
Laravel Cart Manager
Managing the cart in your Laravel/E-commerce application is a breeze
Stars: ✭ 175 (-2.23%)
Mutual labels:  laravel
Laravel Auth Checker
Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.
Stars: ✭ 177 (-1.12%)
Mutual labels:  laravel
Sheets
Store & retrieve your static content in plain text files
Stars: ✭ 175 (-2.23%)
Mutual labels:  laravel
Laravel Api Debugger
Easy debug for your JSON API.
Stars: ✭ 175 (-2.23%)
Mutual labels:  laravel
Laravel Migration Snapshot
Simplify and accelerate applying many migrations at once using a flattened dump of the database schema and migrations
Stars: ✭ 177 (-1.12%)
Mutual labels:  laravel
Laravel Source Encrypter
Laravel and Lumen Source Code Encrypter
Stars: ✭ 175 (-2.23%)
Mutual labels:  laravel
Ldaprecord Laravel
Multi-domain LDAP Authentication & Management for Laravel.
Stars: ✭ 178 (-0.56%)
Mutual labels:  laravel
Laravel Invite Codes
This package allows you to easily manage invite codes for your Laravel application.
Stars: ✭ 174 (-2.79%)
Mutual labels:  laravel
Vue Material Admin
A vue material design admin template
Stars: ✭ 2,170 (+1112.29%)
Mutual labels:  laravel
Laravel Identify
📦 📱 Laravel 5 Package to Detect Users Browsers, Devices, Languages and Operating Systems
Stars: ✭ 177 (-1.12%)
Mutual labels:  laravel
School
Sistema de gerenciamento para escola em Laravel com VueJS (Não é mais Angular)
Stars: ✭ 178 (-0.56%)
Mutual labels:  laravel
Bulma
Bulma Frontend Preset For Laravel Framework 5.5 and Up
Stars: ✭ 177 (-1.12%)
Mutual labels:  laravel

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'),
    ];
}

You can explicitly define the relationship & Nova resource:

AttachMany::make('Field Name', 'relationshipName', RelatedResource::class);

Display on detail:

This package only provides the create / edit views that BelongsToMany does not.

BelongsToMany should be used for displaying the table on detail views.

public function fields(Request $request)
{
    return [
        AttachMany::make('Permissions'),
        BelongsToMany::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
  • ->showRefresh() Request the resources again
  • ->showSubtitle() Show the resource's subtitle
  • ->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

Being Notified of Changes

You can add a method to the resource to be notified of the changes that have happened:

The method must be a camel cased version of the attribute name, followed by Synced. For example:

public function fields(Request $request)
{
    return [
        AttachMany::make('Permissions'),
    ];
}
public function permissionsSynced(array $changes)
{
    $changes['attached']; // An array of IDs of attached models
    $changes['detached']; // An array of IDs of detached models
    $changes['updated']; // An array of IDs of updated models
}

Authorization

This field also respects policies: ie Role / Permission

  • RolePolicy: attachAnyPermission($user, $role)
  • RolePolicy: attachPermission($user, $role, $permission)
  • PermissionPolicy: viewAny($user)

Author

Hi 👋, Im Brian D. I created this Nova package and others

Hope you find it useful. Feel free to reach out with feedback.

Follow me on twitter: @im_brian_d

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].