CustomerNotePolicy::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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 CustomerNotePolicy
10
{
11
    use AllowTrait;
12
    use HandlesAuthorization;
13
14
    /**
15
     *  Determine if the user can create a new note
16
     */
17
    public function create(User $user)
18
    {
19
        return $this->checkPermission($user, 'Add Customer Note');
20
    }
21
22
    /**
23
     *  Determine if the user can update an existing note
24
     */
25
    public function update(User $user)
26
    {
27
        return $this->checkPermission($user, 'Edit Customer Note');
28
    }
29
30
    /**
31
     *  Determine if the user can soft delete a note
32
     */
33
    public function delete(User $user)
34
    {
35
        return $this->checkPermission($user, 'Delete Customer Note');
36
    }
37
38
    /**
39
     *  Determine if the user can restore a deleted note
40
     */
41
    public function restore(User $user)
42
    {
43
        return $this->checkPermission($user, 'Manage Customers');
44
    }
45
46
    /**
47
     *  Determine if the user can permanently delete a note
48
     */
49
    public function forceDelete(User $user)
50
    {
51
        return $this->checkPermission($user, 'Manage Customers');
52
    }
53
}
54