Issues (232)

app/Policies/FightersGroupPolicy.php (5 issues)

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
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 $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
        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
Bug Best Practice introduced by
The property championship does not exist on App\FightersGroup. Since you implemented __get, consider adding a @property annotation.
Loading history...
The property tournament does not seem to exist on Illuminate\Database\Eloquent\Relations\Relation.
Loading history...
The property tournament does not seem to exist on Illuminate\Database\Eloquent\Builder.
Loading history...
32
//        dd($tournament);
33
        return ($tournament->user_id == $user->id);
0 ignored issues
show
The property user_id does not seem to exist on DateTimeZone.
Loading history...
34
35
    }
36
37
38
}
39