1 | <?php |
||||
2 | |||||
3 | namespace Insenseanalytics\LaravelNovaPermission; |
||||
4 | |||||
5 | use Laravel\Nova\Nova; |
||||
0 ignored issues
–
show
|
|||||
6 | use Laravel\Nova\Fields\ID; |
||||
0 ignored issues
–
show
The type
Laravel\Nova\Fields\ID was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
7 | use Illuminate\Http\Request; |
||||
8 | use Laravel\Nova\Fields\Text; |
||||
0 ignored issues
–
show
The type
Laravel\Nova\Fields\Text was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
9 | use Illuminate\Validation\Rule; |
||||
0 ignored issues
–
show
The type
Illuminate\Validation\Rule was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
10 | use Laravel\Nova\Fields\Select; |
||||
0 ignored issues
–
show
The type
Laravel\Nova\Fields\Select was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
11 | use Laravel\Nova\Fields\DateTime; |
||||
0 ignored issues
–
show
The type
Laravel\Nova\Fields\DateTime was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
12 | use Laravel\Nova\Fields\MorphToMany; |
||||
0 ignored issues
–
show
The type
Laravel\Nova\Fields\MorphToMany was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
13 | use Laravel\Nova\Fields\BelongsToMany; |
||||
0 ignored issues
–
show
The type
Laravel\Nova\Fields\BelongsToMany was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
14 | use Spatie\Permission\PermissionRegistrar; |
||||
15 | |||||
16 | trait RoleResourceTrait |
||||
17 | { |
||||
18 | public static function getModel() |
||||
19 | { |
||||
20 | return app(PermissionRegistrar::class)->getRoleClass(); |
||||
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
21 | } |
||||
22 | |||||
23 | /** |
||||
24 | * Get the fields displayed by the resource. |
||||
25 | * |
||||
26 | * @param \Illuminate\Http\Request $request |
||||
27 | * |
||||
28 | * @return array |
||||
29 | */ |
||||
30 | public function fields(Request $request) |
||||
31 | { |
||||
32 | $guardOptions = collect(config('auth.guards'))->mapWithKeys(function ($value, $key) { |
||||
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
33 | return [$key => $key]; |
||||
34 | }); |
||||
35 | |||||
36 | $userResource = Nova::resourceForModel(getModelForGuard($this->guard_name)); |
||||
37 | |||||
38 | $permissionResource = Nova::resourceForModel(app(PermissionRegistrar::class)->getPermissionClass()); |
||||
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
39 | |||||
40 | return [ |
||||
41 | ID::make()->sortable(), |
||||
42 | |||||
43 | Text::make(__('laravel-nova-permission::roles.name'), 'name') |
||||
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
44 | ->rules(['required', 'string', 'max:255']) |
||||
45 | ->creationRules('unique:' . config('permission.table_names.roles')) |
||||
46 | ->updateRules('unique:' . config('permission.table_names.roles') . ',name,{{resourceId}}'), |
||||
47 | |||||
48 | Select::make(__('laravel-nova-permission::roles.guard_name'), 'guard_name') |
||||
49 | ->options($guardOptions->toArray()) |
||||
50 | ->rules(['required', Rule::in($guardOptions)]), |
||||
51 | |||||
52 | DateTime::make(__('laravel-nova-permission::roles.created_at'), 'created_at')->exceptOnForms(), |
||||
53 | |||||
54 | DateTime::make(__('laravel-nova-permission::roles.updated_at'), 'updated_at')->exceptOnForms(), |
||||
55 | |||||
56 | BelongsToMany::make($permissionResource::label(), 'permissions', $permissionResource)->searchable(), |
||||
57 | |||||
58 | MorphToMany::make($userResource::label(), 'users', $userResource)->searchable(), |
||||
59 | ]; |
||||
60 | } |
||||
61 | } |
||||
62 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths