Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
UpdateRolePlayProjectRequest | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
authorize | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
rules | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace App\Http\Requests\v2\RolePlay; |
4 | |
5 | use App\Http\Models\RolePlayProjects; |
6 | use Illuminate\Foundation\Http\FormRequest; |
7 | |
8 | class UpdateRolePlayProjectRequest extends FormRequest |
9 | { |
10 | /** |
11 | * Determine if the user is authorized to make this request. |
12 | * |
13 | * @return bool |
14 | */ |
15 | public function authorize(): bool |
16 | { |
17 | $user = $this->user(); |
18 | |
19 | $project = $this->route('persona'); |
20 | |
21 | return !$project || $user->id === $project->user_id; |
22 | } |
23 | |
24 | /** |
25 | * Get the validation rules that apply to the request. |
26 | * |
27 | * @return array |
28 | */ |
29 | public function rules(): array |
30 | { |
31 | return RolePlayProjects::getRules(); |
32 | } |
33 | } |