Completed
Push — master ( 08375c...9f214f )
by Mohamed
11:05
created

SettingPolicy::viewAny()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Microboard\Policies;
4
5
use Illuminate\Auth\Access\HandlesAuthorization;
6
use Microboard\Models\Setting;
7
use App\User;
8
9
class SettingPolicy
10
{
11
    use HandlesAuthorization;
12
13
    /**
14
     * Determine whether the user can view any models.
15
     *
16
     * @param  User  $user
17
     * @return mixed
18
     */
19
    public function viewAny(User $user)
20
    {
21
        return $user->permissions()->contains('name', 'settings-viewAny');
22
    }
23
24
    /**
25
     * Determine whether the user can create models.
26
     *
27
     * @param  User  $user
28
     * @return mixed
29
     */
30
    public function create(User $user)
31
    {
32
        return $user->permissions()->contains('name', 'settings-create');
33
    }
34
35
    /**
36
     * Determine whether the user can update the model.
37
     *
38
     * @param  User  $user
39
     * @return mixed
40
     */
41
    public function update(User $user)
42
    {
43
        return $user->permissions()->contains('name', 'settings-update');
44
    }
45
46
    /**
47
     * Determine whether the user can delete the model.
48
     *
49
     * @param  User  $user
50
     * @param  Setting  $model
51
     * @return mixed
52
     */
53
    public function delete(User $user, Setting $model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
54
    {
55
        return $user->permissions()->contains('name', 'settings-delete');
56
    }
57
}
58