Passed
Push — main ( bb1631...b48e8d )
by PRATIK
07:52 queued 04:02
created

AboutPolicy::restore()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Adminetic\Website\Policies;
4
5
use Adminetic\Website\Models\Admin\About;
6
use App\Models\User;
0 ignored issues
show
Bug introduced by
The type App\Models\User 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Illuminate\Auth\Access\HandlesAuthorization;
8
9
class AboutPolicy
10
{
11
    use HandlesAuthorization;
12
13
    public function before($user, $ability)
0 ignored issues
show
Unused Code introduced by
The parameter $ability is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

13
    public function before($user, /** @scrutinizer ignore-unused */ $ability)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    {
15
        if ($user->isSuperAdmin()) {
16
            return true;
17
        }
18
    }
19
20
21
    /**
22
     * Determine whether the user can view any models.
23
     *
24
     * @param  \App\Models\User  $user
25
     * @return mixed
26
     */
27
    public function viewAny(User $user)
28
    {
29
        return $user->userCanDo('About', 'browse');
30
    }
31
32
    /**
33
     * Determine whether the user can view the model.
34
     *
35
     * @param  \App\Models\User  $user
36
     * @param  \App\Models\Admin\About  $about
0 ignored issues
show
Bug introduced by
The type App\Models\Admin\About 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
37
     * @return mixed
38
     */
39
    public function view(User $user, About $about)
0 ignored issues
show
Unused Code introduced by
The parameter $about is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

39
    public function view(User $user, /** @scrutinizer ignore-unused */ About $about)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
        return $user->userCanDo('About', 'read');
42
    }
43
44
    /**
45
     * Determine whether the user can create models.
46
     *
47
     * @param  \App\Models\User  $user
48
     * @return mixed
49
     */
50
    public function create(User $user)
51
    {
52
        return $user->userCanDo('About', 'add');
53
    }
54
55
    /**
56
     * Determine whether the user can update the model.
57
     *
58
     * @param  \App\Models\User  $user
59
     * @param  \App\Models\Admin\About  $about
60
     * @return mixed
61
     */
62
    public function update(User $user, About $about)
0 ignored issues
show
Unused Code introduced by
The parameter $about is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

62
    public function update(User $user, /** @scrutinizer ignore-unused */ About $about)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
63
    {
64
        return $user->userCanDo('About', 'edit');
65
    }
66
67
    /**
68
     * Determine whether the user can delete the model.
69
     *
70
     * @param  \App\Models\User  $user
71
     * @param  \App\Models\Admin\About  $about
72
     * @return mixed
73
     */
74
    public function delete(User $user, About $about)
0 ignored issues
show
Unused Code introduced by
The parameter $about is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

74
    public function delete(User $user, /** @scrutinizer ignore-unused */ About $about)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
75
    {
76
        return $user->userCanDo('About', 'delete');
77
    }
78
79
    /**
80
     * Determine whether the user can restore the model.
81
     *
82
     * @param  \App\Models\User  $user
83
     * @param  \App\Models\Admin\About  $about
84
     * @return mixed
85
     */
86
    public function restore(User $user, About $about)
0 ignored issues
show
Unused Code introduced by
The parameter $about is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

86
    public function restore(User $user, /** @scrutinizer ignore-unused */ About $about)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $user is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

86
    public function restore(/** @scrutinizer ignore-unused */ User $user, About $about)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
87
    {
88
        return true;
89
    }
90
91
    /**
92
     * Determine whether the user can permanently delete the model.
93
     *
94
     * @param  \App\Models\User  $user
95
     * @param  \App\Models\Admin\About  $about
96
     * @return mixed
97
     */
98
    public function forceDelete(User $user, About $about)
0 ignored issues
show
Unused Code introduced by
The parameter $user is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

98
    public function forceDelete(/** @scrutinizer ignore-unused */ User $user, About $about)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $about is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

98
    public function forceDelete(User $user, /** @scrutinizer ignore-unused */ About $about)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
99
    {
100
        return true;
101
    }
102
}
103