1 | <?php |
||
2 | |||
3 | namespace App\Policies; |
||
4 | |||
5 | use App\Tournament; |
||
6 | use App\User; |
||
7 | use Illuminate\Auth\Access\HandlesAuthorization; |
||
8 | |||
9 | class TeamPolicy |
||
10 | { |
||
11 | use HandlesAuthorization; |
||
12 | |||
13 | /** |
||
14 | * Create a new policy instance. |
||
15 | * @param User $user |
||
16 | * @param $ability |
||
17 | * @return bool |
||
18 | */ |
||
19 | public function before(User $user, $ability) |
||
0 ignored issues
–
show
|
|||
20 | { |
||
21 | if ($user->isSuperAdmin()) { |
||
22 | return true; |
||
23 | } |
||
24 | return null; |
||
25 | } |
||
26 | |||
27 | // You can create a user if you are not a simple user |
||
28 | public function create(User $user, Tournament $tournament) |
||
29 | { |
||
30 | return $user->isOwner($tournament); |
||
31 | } |
||
32 | |||
33 | |||
34 | public function edit(User $user, Tournament $tournament) |
||
35 | { |
||
36 | return $user->isOwner($tournament); |
||
37 | } |
||
38 | |||
39 | |||
40 | // You can store a user if you are not a simple user |
||
41 | public function store(User $user, Tournament $tournament) |
||
42 | { |
||
43 | return $user->isOwner($tournament); |
||
44 | } |
||
45 | |||
46 | public function update(User $user, Tournament $tournament) |
||
47 | { |
||
48 | return $user->isOwner($tournament); |
||
49 | } |
||
50 | |||
51 | public function delete(User $user, \Xoco70\LaravelTournaments\Models\Tournament $tournament) |
||
52 | { |
||
53 | return $user->isOwner($tournament); |
||
54 | } |
||
55 | |||
56 | } |
||
57 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.