xoco70 /
kendozone
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace App\Policies; |
||||||
| 4 | |||||||
| 5 | use App\Club; |
||||||
| 6 | use App\User; |
||||||
| 7 | use Illuminate\Auth\Access\HandlesAuthorization; |
||||||
| 8 | |||||||
| 9 | class ClubPolicy |
||||||
| 10 | { |
||||||
| 11 | use HandlesAuthorization; |
||||||
| 12 | |||||||
| 13 | |||||||
| 14 | 3 | public function before(User $user, $ability) |
|||||
|
0 ignored issues
–
show
|
|||||||
| 15 | { |
||||||
| 16 | 3 | if ($user->isSuperAdmin()) { |
|||||
| 17 | 1 | return true; |
|||||
| 18 | } |
||||||
| 19 | 2 | return null; |
|||||
| 20 | } |
||||||
| 21 | |||||||
| 22 | public function create(User $user) |
||||||
| 23 | { |
||||||
| 24 | if ($user->isFederationPresident() || $user->isAssociationPresident()) { |
||||||
| 25 | return true; |
||||||
| 26 | } |
||||||
| 27 | return false; |
||||||
| 28 | } |
||||||
| 29 | |||||||
| 30 | 2 | public function edit(User $user, Club $club) |
|||||
| 31 | { |
||||||
| 32 | 2 | if ($user->isFederationPresident()) { |
|||||
| 33 | return $club->belongsToFederationPresident($user); |
||||||
| 34 | } |
||||||
| 35 | 2 | if ($user->isAssociationPresident()) { |
|||||
| 36 | 1 | return $club->belongsToAssociationPresident($user); |
|||||
| 37 | } |
||||||
| 38 | 1 | if ($user->isClubPresident()) { |
|||||
| 39 | 1 | return $club->belongsToClubPresident($user); |
|||||
| 40 | } |
||||||
| 41 | return false; |
||||||
| 42 | |||||||
| 43 | } |
||||||
| 44 | |||||||
| 45 | public function update(User $user, Club $club) |
||||||
| 46 | { |
||||||
| 47 | if ($user->isFederationPresident()) { |
||||||
| 48 | return $club->belongsToFederationPresident($user); |
||||||
| 49 | } |
||||||
| 50 | if ($user->isAssociationPresident()) { |
||||||
| 51 | return $club->belongsToAssociationPresident($user); |
||||||
| 52 | } |
||||||
| 53 | if ($user->isClubPresident()) { |
||||||
| 54 | return $club->belongsToClubPresident($user); |
||||||
| 55 | } |
||||||
| 56 | return false; |
||||||
| 57 | } |
||||||
| 58 | |||||||
| 59 | public function store(User $user, Club $club) |
||||||
|
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
$club 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...
|
|||||||
| 60 | { |
||||||
| 61 | return true; |
||||||
| 62 | // if ($user->isFederationPresident()) { |
||||||
| 63 | // return $club->belongsToFederationPresident($user); |
||||||
| 64 | // |
||||||
| 65 | // } |
||||||
| 66 | // if ($user->isAssociationPresident()) { |
||||||
| 67 | // return $club->belongsToAssociationPresident($user); |
||||||
| 68 | // } |
||||||
| 69 | // return false; |
||||||
| 70 | } |
||||||
| 71 | |||||||
| 72 | public function delete(User $user, Club $club) |
||||||
| 73 | { |
||||||
| 74 | if ($user->isFederationPresident()) { |
||||||
| 75 | return $club->belongsToFederationPresident($user); |
||||||
| 76 | |||||||
| 77 | } |
||||||
| 78 | if ($user->isAssociationPresident()) { |
||||||
| 79 | return $club->belongsToAssociationPresident($user); |
||||||
| 80 | } |
||||||
| 81 | return false; |
||||||
| 82 | } |
||||||
| 83 | |||||||
| 84 | |||||||
| 85 | } |
||||||
| 86 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.