Skip to content

Commit

Permalink
add permission display_name computed field
Browse files Browse the repository at this point in the history
  • Loading branch information
vyuldashev committed Aug 29, 2018
1 parent 69d9d96 commit c9eb354
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions resources/lang/en/permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

return [
'name' => 'Name',
'display_name' => 'Display Name',
'guard_name' => 'Guard Name',
'created_at' => 'Created at',
'updated_at' => 'Updated at',
Expand Down
10 changes: 8 additions & 2 deletions src/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ public function fields(Request $request)

Text::make(__('nova-permission-tool::permissions.name'), 'name')
->rules(['required', 'string', 'max:255'])
->creationRules('unique:'.config('permission.table_names.permissions'))
->updateRules('unique:'.config('permission.table_names.permissions').',name,{{resourceId}}'),
->creationRules('unique:' . config('permission.table_names.permissions'))
->updateRules('unique:' . config('permission.table_names.permissions') . ',name,{{resourceId}}'),

Text::make(__('nova-permission-tool::permissions.display_name'), function () {
return __('nova-permission-tool::permissions.display_names.' . $this->name);
})->canSee(function () {
return is_array(__('nova-permission-tool::permissions.display_names'));
}),

Select::make(__('nova-permission-tool::permissions.guard_name'), 'guard_name')
->options($guardOptions->toArray())
Expand Down

0 comments on commit c9eb354

Please sign in to comment.