Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 69.23% |
Changes | 0 |
1 | <?php |
||
7 | class AuthRequest extends Request |
||
8 | { |
||
9 | |||
10 | 2 | public function __construct(\Illuminate\Http\Request $request) |
|
11 | { |
||
12 | // Insert needed fields in request if not present |
||
13 | |||
14 | 2 | $request->request->add(['role_id' => config('constants.ROLE_USER')]); |
|
15 | |||
16 | 2 | $token = $request->get("token"); |
|
17 | 2 | if (!isNullOrEmptyString($token)) { |
|
18 | $invite = Invite::getInviteFromToken($token); |
||
19 | if (!$request->has('email')) { |
||
20 | $request->request->add(['email' => $invite->email]); |
||
21 | $request->request->add(['verified' => 1]); |
||
22 | } |
||
23 | } |
||
24 | 2 | } |
|
25 | |||
26 | /** |
||
27 | * Determine if the user is authorized to make this request. |
||
28 | * |
||
29 | * @return bool |
||
30 | */ |
||
31 | 2 | public function authorize() |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * Get the validation rules that apply to the request. |
||
38 | * |
||
39 | * @return array |
||
40 | */ |
||
41 | 2 | public function rules() |
|
53 |