Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
QuestionPolicy
n/a
0 / 0
n/a
0 / 0
6
n/a
0 / 0
 view
n/a
0 / 0
n/a
0 / 0
1
 viewAny
n/a
0 / 0
n/a
0 / 0
1
 create
n/a
0 / 0
n/a
0 / 0
1
 update
n/a
0 / 0
n/a
0 / 0
1
 delete
n/a
0 / 0
n/a
0 / 0
1
 questionBelongsToService
n/a
0 / 0
n/a
0 / 0
1
1<?php
2
3namespace App\Policies;
4
5use App\Models\Question;
6use App\Models\Service;
7use App\Policies\Rules\UserStaticRules as USR;
8
9/**
10 * @codeCoverageIgnore
11 */
12class QuestionPolicy
13{
14    /**
15     * View a Question.
16     *
17     * @return boolean
18     */
19    public function view(): bool
20    {
21        return USR::everyOne();
22    }
23
24    /**
25     * viewAny a Question.
26     * @return boolean
27     */
28    public function viewAny(): bool
29    {
30        return USR::everyOne();
31    }
32
33    /**
34     * Create a Question.
35     *
36     * @return boolean
37     */
38    public function create(): bool
39    {
40        return USR::everyOne();
41    }
42
43    /**
44     * Update a Question.
45     *
46     * @return boolean
47     */
48    public function update(): bool
49    {
50        return USR::everyOne();
51    }
52
53    /**
54     * Delete a Question.
55     *
56     * @return boolean
57     */
58    public function delete(): bool
59    {
60        return USR::everyOne();
61    }
62
63    /**
64     * Check if the question belongs to the service
65     *
66     * @param \App\Models\Service  $service
67     * @param \App\Models\Question $question
68     * @return boolean
69     */
70    public function questionBelongsToService(Service $service, Question $question)
71    {
72        return $service->brand->id === $question->brand_id;
73    }
74}