Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
FlycutReshareRequest
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 authorize
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 failedAuthorization
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 rules
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Http\Requests;
4
5use Illuminate\Auth\Access\AuthorizationException;
6use Illuminate\Foundation\Http\FormRequest;
7
8class FlycutReshareRequest extends FormRequest
9{
10    /**
11     * Determine if the user is authorized to make this request.
12     */
13    public function authorize(): bool
14    {
15        return $this->user()->email !== $this->email;
16    }
17
18    /**
19     * Handle a failed authorization attempt.
20     *
21     *
22     * @throws \Illuminate\Auth\Access\AuthorizationException
23     */
24    protected function failedAuthorization(): void
25    {
26        throw new AuthorizationException("You can't share a flymsg with yourself");
27    }
28
29    /**
30     * Get the validation rules that apply to the request.
31     */
32    public function rules(): array
33    {
34        return [
35            'email' => 'required|email',
36            'cloned_shortcut_id' => 'required|exists:cloned_shared_shortcuts,_id',
37        ];
38    }
39}