1 | <?php |
||||||||
2 | |||||||||
3 | namespace App\Admin\Policies; |
||||||||
4 | |||||||||
5 | use App\Admin\Sections\Users; |
||||||||
6 | use App\User; |
||||||||
7 | use Illuminate\Auth\Access\HandlesAuthorization; |
||||||||
8 | |||||||||
9 | class UsersSectionModelPolicy |
||||||||
10 | { |
||||||||
11 | use HandlesAuthorization; |
||||||||
12 | |||||||||
13 | /** |
||||||||
14 | * @param User $user |
||||||||
15 | * @param string $ability |
||||||||
16 | * @param Users $section |
||||||||
17 | * @param User $item |
||||||||
18 | * |
||||||||
19 | * @return bool |
||||||||
20 | */ |
||||||||
21 | public function before(User $user, $ability, Users $section, User $item = null) |
||||||||
0 ignored issues
–
show
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
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...
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
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...
The parameter
$item 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
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...
|
|||||||||
22 | { |
||||||||
23 | // if ($user->isAdmin()) { |
||||||||
24 | // return true; |
||||||||
25 | // } |
||||||||
26 | } |
||||||||
27 | |||||||||
28 | public function display(User $user, Users $section, User $item) |
||||||||
0 ignored issues
–
show
The parameter
$section 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
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...
The parameter
$item 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
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...
|
|||||||||
29 | { |
||||||||
30 | if ($user->isAdmin()) { |
||||||||
31 | return true; |
||||||||
32 | } |
||||||||
33 | |||||||||
34 | return false; |
||||||||
35 | } |
||||||||
36 | |||||||||
37 | public function create(User $user, Users $section, User $item) |
||||||||
0 ignored issues
–
show
The parameter
$section 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
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...
The parameter
$item 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
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...
|
|||||||||
38 | { |
||||||||
39 | if ($user->isAdmin()) { |
||||||||
40 | return true; |
||||||||
41 | } |
||||||||
42 | |||||||||
43 | return false; |
||||||||
44 | } |
||||||||
45 | |||||||||
46 | public function edit(User $user, Users $section, User $item) |
||||||||
0 ignored issues
–
show
The parameter
$section 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
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...
The parameter
$item 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
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...
|
|||||||||
47 | { |
||||||||
48 | if ($user->isAdmin()) { |
||||||||
49 | return true; |
||||||||
50 | } |
||||||||
51 | |||||||||
52 | return false; |
||||||||
53 | } |
||||||||
54 | |||||||||
55 | public function delete(User $user, Users $section, User $item) |
||||||||
56 | { |
||||||||
57 | if ($user->isAdmin()) { |
||||||||
58 | return $item->id > 3; |
||||||||
59 | } |
||||||||
60 | |||||||||
61 | return false; |
||||||||
62 | } |
||||||||
63 | |||||||||
64 | public function restore(User $user, Users $section, User $item) |
||||||||
0 ignored issues
–
show
The parameter
$item 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
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...
The parameter
$section 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
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...
|
|||||||||
65 | { |
||||||||
66 | if ($user->isAdmin()) { |
||||||||
67 | return true; |
||||||||
68 | } |
||||||||
69 | |||||||||
70 | return false; |
||||||||
71 | } |
||||||||
72 | |||||||||
73 | // public function destroy(User $user, Users $section, User $item) { |
||||||||
74 | // if ($user->isAdmin()) { |
||||||||
75 | // return true; |
||||||||
76 | // } |
||||||||
77 | // return false; |
||||||||
78 | // } |
||||||||
79 | } |
||||||||
80 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.