xoco70 /
kendozone
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Policies; |
||
| 4 | |||
| 5 | use App\FightersGroup; |
||
| 6 | use App\Tournament; |
||
| 7 | use App\User; |
||
| 8 | |||
| 9 | class FightersGroupPolicy |
||
| 10 | { |
||
| 11 | // use HandlesAuthorization; |
||
| 12 | |||
| 13 | public function before(User $user, $ability) |
||
|
0 ignored issues
–
show
|
|||
| 14 | { |
||
| 15 | if ($user->isSuperAdmin()) { |
||
| 16 | return true; |
||
| 17 | } |
||
| 18 | return null; |
||
| 19 | } |
||
| 20 | |||
| 21 | |||
| 22 | // You can store a user if you are not a simple user |
||
| 23 | public function store(User $user, Tournament $tournament) |
||
| 24 | { |
||
| 25 | return ($tournament->user_id == $user->id); |
||
| 26 | } |
||
| 27 | |||
| 28 | |||
| 29 | public function destroy(User $user, FightersGroup $tree) |
||
| 30 | { |
||
| 31 | $tournament = $tree->championship->tournament; |
||
|
0 ignored issues
–
show
The property
championship does not exist on App\FightersGroup. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 32 | // dd($tournament); |
||
| 33 | return ($tournament->user_id == $user->id); |
||
|
0 ignored issues
–
show
|
|||
| 34 | |||
| 35 | } |
||
| 36 | |||
| 37 | |||
| 38 | } |
||
| 39 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.