From 20c5d0dfd7dbcabb60b8dfb46008ce6684c4b8c5 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 10 May 2022 17:16:18 +0200 Subject: [PATCH 1/2] fix: nova-4 compatibility --- composer.json | 94 ++++++++++++++++++--------------- src-php/NovaToolPermissions.php | 6 ++- src-php/Role.php | 6 +-- 3 files changed, 58 insertions(+), 48 deletions(-) diff --git a/composer.json b/composer.json index 94c804a..0153a03 100644 --- a/composer.json +++ b/composer.json @@ -1,47 +1,53 @@ { - "name": "silvanite/novatoolpermissions", - "description": "Laravel Nova Permissions (Roles and Permission based Access Control (ACL))", - "keywords": [ - "laravel", - "nova", - "tool", - "acl", - "roles", - "permissions", - "access control", - "gates", - "policies", - "authentication", - "authorization" - ], - "license": "MIT", - "authors": [ - { - "name": "Marco Mark", - "email": "m2de@outlook.com" - } - ], - "require": { - "php": ">=7.1.3", - "laravel/framework": ">=5.6.0", - "silvanite/brandenburg": "^1.0", - "silvanite/novafieldcheckboxes": "^1.0", - "benjaminhirsch/nova-slug-field": "^1.2.3" - }, - "require-dev": { - "squizlabs/php_codesniffer": ">=3.1" - }, - "autoload": { - "psr-4": { - "Silvanite\\NovaToolPermissions\\": "src-php/" - } - }, - "extra":{ - "laravel": { - "providers": [ - "Silvanite\\NovaToolPermissions\\Providers\\AuthServiceProvider", - "Silvanite\\NovaToolPermissions\\Providers\\PackageServiceProvider" - ] - } + "name": "silvanite/novatoolpermissions", + "description": "Laravel Nova Permissions (Roles and Permission based Access Control (ACL))", + "keywords": [ + "laravel", + "nova", + "tool", + "acl", + "roles", + "permissions", + "access control", + "gates", + "policies", + "authentication", + "authorization" + ], + "license": "MIT", + "authors": [ + { + "name": "Marco Mark", + "email": "m2de@outlook.com" } + ], + "require": { + "php": ">=7.4", + "laravel/framework": ">=8.0", + "silvanite/brandenburg": "^1.0", + "silvanite/novafieldcheckboxes": "^1.0", + "laravel/nova": "^4.1" + }, + "require-dev": { + "squizlabs/php_codesniffer": ">=3.1" + }, + "autoload": { + "psr-4": { + "Silvanite\\NovaToolPermissions\\": "src-php/" + } + }, + "repositories": [ + { + "type": "composer", + "url": "https://nova.laravel.com" + } + ], + "extra": { + "laravel": { + "providers": [ + "Silvanite\\NovaToolPermissions\\Providers\\AuthServiceProvider", + "Silvanite\\NovaToolPermissions\\Providers\\PackageServiceProvider" + ] + } + } } diff --git a/src-php/NovaToolPermissions.php b/src-php/NovaToolPermissions.php index b7051c4..7641cd5 100644 --- a/src-php/NovaToolPermissions.php +++ b/src-php/NovaToolPermissions.php @@ -2,9 +2,9 @@ namespace Silvanite\NovaToolPermissions; +use Illuminate\Http\Request; use Laravel\Nova\Nova; use Laravel\Nova\Tool; -use Silvanite\NovaToolPermissions\Role; class NovaToolPermissions extends Tool { @@ -19,4 +19,8 @@ public function boot() Role::class, ]); } + + public function menu(Request $request) + { + } } diff --git a/src-php/Role.php b/src-php/Role.php index 0119e3b..94a0388 100644 --- a/src-php/Role.php +++ b/src-php/Role.php @@ -2,16 +2,15 @@ namespace Silvanite\NovaToolPermissions; +use Laravel\Nova\Fields\Slug; use Laravel\Nova\Resource; use Laravel\Nova\Fields\ID; use Illuminate\Http\Request; use Laravel\Nova\Fields\Text; use Silvanite\Brandenburg\Policy; -use Benjaminhirsch\NovaSlugField\Slug; use Laravel\Nova\Fields\BelongsToMany; use Silvanite\Brandenburg\Role as RoleModel; use Silvanite\NovaFieldCheckboxes\Checkboxes; -use Benjaminhirsch\NovaSlugField\TextWithSlug; class Role extends Resource { @@ -55,9 +54,10 @@ public function fields(Request $request) return [ ID::make()->sortable(), - TextWithSlug::make(__('Name'), 'name')->sortable()->slug('slug'), + Text::make(__('Name'), 'name')->sortable(), Slug::make(__('Slug'), 'slug') + ->from('name') ->rules('required') ->creationRules('unique:roles') ->updateRules('unique:roles,slug,{{resourceId}}') From 38a3f4050411591bcc2fc0ee083b84aa777810ed Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 17 May 2022 19:14:30 +0200 Subject: [PATCH 2/2] fix: novafieldcheckboxes dependency --- composer.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 0153a03..33e5b64 100644 --- a/composer.json +++ b/composer.json @@ -25,11 +25,11 @@ "php": ">=7.4", "laravel/framework": ">=8.0", "silvanite/brandenburg": "^1.0", - "silvanite/novafieldcheckboxes": "^1.0", - "laravel/nova": "^4.1" + "silvanite/novafieldcheckboxes": "dev-nova-4" }, "require-dev": { - "squizlabs/php_codesniffer": ">=3.1" + "squizlabs/php_codesniffer": ">=3.1", + "laravel/nova": "^4.1" }, "autoload": { "psr-4": { @@ -40,6 +40,10 @@ { "type": "composer", "url": "https://nova.laravel.com" + }, + { + "type": "vcs", + "url": "https://github.com/boxraiser/novafieldcheckboxes" } ], "extra": {