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

FinishSetupRequest::authorize()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 2
nc 2
nop 0
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