Passed
Push — dev6 ( 72e99e...1f4a51 )
by Ron
18:35
created

CustomerNotePolicy::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\CustomerNote;
6
use App\Models\User;
7
use App\Traits\AllowTrait;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class CustomerNotePolicy
11
{
12
    use AllowTrait;
1 ignored issue
show
introduced by
The trait App\Traits\AllowTrait requires some properties which are not provided by App\Policies\CustomerNotePolicy: $role_id, $username, $allow
Loading history...
13
    use HandlesAuthorization;
14
15
    /**
16
     *  Determine if the user can create a new note
17
     */
18 4
    public function create(User $user)
19
    {
20 4
        return $this->checkPermission($user, 'Add Customer Note');
21
    }
22
23
    /**
24
     *  Determine if the user can update an existing note
25
     */
26 4
    public function update(User $user)
27
    {
28 4
        return $this->checkPermission($user, 'Edit Customer Note');
29
    }
30
31
    /**
32
     *  Determine if the user can soft delete a note
33
     */
34 3
    public function delete(User $user)
35
    {
36 3
        return $this->checkPermission($user, 'Delete Customer Note');
37
    }
38
39
    /**
40
     *  Determine if the user can restore a deleted note
41
     */
42 2
    public function restore(User $user)
43
    {
44 2
        return $this->checkPermission($user, 'Manage Customers');
45
    }
46
47
    /**
48
     *  Determine if the user can permanently delete a note
49
     */
50 2
    public function forceDelete(User $user)
51
    {
52 2
        return $this->checkPermission($user, 'Manage Customers');
53
    }
54
}
55