scouser03 / group-checkbox
A Laravel Nova field.
Installs: 614
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Vue
Requires
- php: ^7.3|^8.0
README
Installation
First you must install this package in to a Laravel app that uses Nova via composer:
composer require scouser03/group-checkbox
Usage
namespace App\Nova; use Scouser03\GroupCheckbox\GroupCheckbox; class BlogPost extends Resource { // ... public function fields(Request $request) { return [ // ... GroupCheckbox::make(__('Permissions'), 'prepared_permissions') ->withGroups() ->options(ModelsPermission::all()->map(function ($permission, $key) { return [ 'group' => __(ucfirst($permission->group)), 'option' => $permission->name, 'label' => __($permission->name), ]; })->groupBy('group')->toArray()), // ... ]; } }
License
The MIT License (MIT). Please see License File for more information.