TopicPolicy::sink()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Transmissor\Policies;
4
5
use Illuminate\Auth\Access\HandlesAuthorization;
6
use App\Models\User;
7
use App\Models\Topic;
8
9
class TopicPolicy
10
{
11
    use HandlesAuthorization;
12
13
    public function show_draft(User $user, Topic $topic)
14
    {
15
        return $user->may('manage_topics') || $topic->user_id == $user->id;
16
    }
17
18
    public function update(User $user, Topic $topic)
19
    {
20
        return $user->may('manage_topics') || $topic->user_id == $user->id;
21
    }
22
23
    public function delete(User $user, Topic $topic)
24
    {
25
        return $user->may('manage_topics') || $topic->user_id == $user->id;
26
    }
27
28
    public function recommend(User $user, Topic $topic)
0 ignored issues
show
Unused Code introduced by
The parameter $topic 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...
29
    {
30
        return $user->may('manage_topics');
31
    }
32
33
    public function wiki(User $user, Topic $topic)
0 ignored issues
show
Unused Code introduced by
The parameter $topic 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...
34
    {
35
        return $user->may('manage_topics');
36
    }
37
38
    public function pin(User $user, Topic $topic)
0 ignored issues
show
Unused Code introduced by
The parameter $topic 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...
39
    {
40
        return $user->may('manage_topics');
41
    }
42
43
    public function sink(User $user, Topic $topic)
0 ignored issues
show
Unused Code introduced by
The parameter $topic 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...
44
    {
45
        return $user->may('manage_topics');
46
    }
47
48
    public function append(User $user, Topic $topic)
49
    {
50
        return $user->may('manage_topics') || $topic->user_id == $user->id;
51
    }
52
}
53