Completed
Push — master ( 8927df...f70445 )
by Abdelrahman
02:05
created

UserRegistrationRequest::forbiddenResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Rinvex Fort Package.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Rinvex Fort Package
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
namespace Rinvex\Fort\Http\Requests\Frontend;
17
18
use Rinvex\Support\Http\Requests\FormRequest;
19
20
class UserRegistrationRequest extends FormRequest
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function forbiddenResponse()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
26
    {
27
        return intend([
28
            'intended'   => url('/'),
29
            'withErrors' => ['rinvex.fort.registration.disabled' => trans('rinvex/fort::frontend/messages.register.disabled')],
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 127 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
30
        ]);
31
    }
32
33
    /**
34
     * Determine if the user is authorized to make this request.
35
     *
36
     * @return bool
37
     */
38
    public function authorize()
39
    {
40
        return config('rinvex.fort.registration.enabled');
41
    }
42
43
    /**
44
     * Get the validation rules that apply to the request.
45
     *
46
     * @return array
47
     */
48
    public function rules()
49
    {
50
        return $this->isMethod('post') ? [
51
            'email'    => 'required|email|max:255|unique:'.config('rinvex.fort.tables.users').',email',
52
            'username' => 'required|alpha_dash|max:255|unique:'.config('rinvex.fort.tables.users').',username',
53
            'password' => 'required|confirmed|min:'.config('rinvex.fort.passwordreset.minimum_characters'),
54
        ] : [];
55
    }
56
}
57