Passed
Push — dev6 ( 98cfbc...9c7079 )
by Ron
19:23
created

CustomerContactPolicy   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 8
c 2
b 0
f 0
dl 0
loc 43
ccs 9
cts 9
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A forceDelete() 0 3 1
A create() 0 3 1
A update() 0 3 1
A delete() 0 3 1
A restore() 0 3 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Traits\AllowTrait;
7
use Illuminate\Auth\Access\HandlesAuthorization;
8
9
class CustomerContactPolicy
10
{
11
    use AllowTrait;
1 ignored issue
show
introduced by
The trait App\Traits\AllowTrait requires some properties which are not provided by App\Policies\CustomerContactPolicy: $role_id, $username, $allow
Loading history...
12
    use HandlesAuthorization;
13
14
    /**
15
     *  Determine if the user can create a contact
16
     */
17
    public function create(User $user)
18
    {
19 4
        return $this->checkPermission($user, 'Add Customer Contact');
20
    }
21 4
22
    /**
23
     *  Determine if the user can update a contact
24
     */
25
    public function update(User $user)
26
    {
27 4
        return $this->checkPermission($user, 'Edit Customer Contact');
28
    }
29 4
30
    /**
31
     *  Determine if the user can delete a contact
32
     */
33
    public function delete(User $user)
34
    {
35 3
        return $this->checkPermission($user, 'Delete Customer Contact');
36
    }
37 3
38
    /**
39
     *  Determine if the user can restore a deleted contact
40
     */
41
    public function restore(User $user)
42
    {
43 2
        return $this->checkPermission($user, 'Manage Customers');
44
    }
45 2
46
    /**
47
     *  Determine if the user can permanently delete a contact
48
     */
49
    public function forceDelete(User $user)
50
    {
51 2
        return $this->checkPermission($user, 'Manage Customers');
52
    }
53
}
54