Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nova 4 compatibility #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 53 additions & 43 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,57 @@
{
"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": "[email protected]"
}
],
"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/"
}
"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": "[email protected]"
}
],
"require": {
"php": ">=7.4",
"laravel/framework": ">=8.0",
"silvanite/brandenburg": "^1.0",
"silvanite/novafieldcheckboxes": "dev-nova-4"
},
"require-dev": {
"squizlabs/php_codesniffer": ">=3.1",
"laravel/nova": "^4.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"
]
}
{
"type": "vcs",
"url": "https://github.com/boxraiser/novafieldcheckboxes"
}
],
"extra": {
"laravel": {
"providers": [
"Silvanite\\NovaToolPermissions\\Providers\\AuthServiceProvider",
"Silvanite\\NovaToolPermissions\\Providers\\PackageServiceProvider"
]
}
}
}
6 changes: 5 additions & 1 deletion src-php/NovaToolPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -19,4 +19,8 @@ public function boot()
Role::class,
]);
}

public function menu(Request $request)
{
}
}
6 changes: 3 additions & 3 deletions src-php/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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}}')
Expand Down