generated from filamentphp/plugin-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathFilamentCommentPolicy.php
59 lines (47 loc) · 1.34 KB
/
FilamentCommentPolicy.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace Parallax\FilamentComments\Policies;
use Illuminate\Contracts\Auth\Authenticatable;
use Parallax\FilamentComments\Models\FilamentComment;
class FilamentCommentPolicy
{
public function viewAny(Authenticatable $user): bool
{
return true;
}
public function view(Authenticatable $user, FilamentComment $filamentComment): bool
{
return true;
}
public function create(Authenticatable $user): bool
{
return true;
}
public function update(Authenticatable $user, FilamentComment $filamentComment): bool
{
return false;
}
public function delete(Authenticatable $user, FilamentComment $filamentComment): bool
{
return $user->id === $filamentComment->user_id && $user->getMorphClass() === $filamentComment->user_type;
}
public function deleteAny(Authenticatable $user): bool
{
return false;
}
public function restore(Authenticatable $user, FilamentComment $filamentComment): bool
{
return false;
}
public function restoreAny(Authenticatable $user): bool
{
return false;
}
public function forceDelete(Authenticatable $user, FilamentComment $filamentComment): bool
{
return false;
}
public function forceDeleteAny(Authenticatable $user): bool
{
return false;
}
}