Passed
Push — dev6 ( 77ef26...6e2ff7 )
by Ron
16:42
created

FinishSetupRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 5 2
A rules() 0 5 1
1
<?php
2
3
namespace App\Http\Requests\User;
4
5
use App\Models\UserInitialize;
6
use Illuminate\Foundation\Http\FormRequest;
7
8
class FinishSetupRequest extends FormRequest
9
{
10
    /**
11
     * Determine if the user is authorized to make this request
12
     */
13
    public function authorize()
14
    {
15
        //  Verify that the token is valid
16
        $token = UserInitialize::where('token', $this->route()->token)->count();
17
        return $token == 1 ? true : false;
18
    }
19
20
    /**
21
     * Get the validation rules that apply to the request
22
     */
23
    public function rules()
24
    {
25
        return [
26
            'username' => 'required|exists:user_initializes',
27
            'password' => 'required|min:6|confirmed',
28
        ];
29
    }
30
}
31