Completed
Push — master ( 459c90...29a4ac )
by ARCANEDEV
03:28
created

PasswordResetRoutes::map()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 11
nc 2
nop 1
1
<?php namespace Arcanesoft\Auth\Http\Routes\Front;
2
3
use Arcanedev\Support\Bases\RouteRegister;
4
use Illuminate\Contracts\Routing\Registrar;
5
6
/**
7
 * Class     PasswordResetRoutes
8
 *
9
 * @package  Arcanesoft\Auth\Http\Routes\Front
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class PasswordResetRoutes extends RouteRegister
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Main Functions
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /**
19
     * Map routes.
20
     *
21
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
22
     */
23
    public function map(Registrar $router)
24
    {
25
        if ($this->isEnabled()) {
26
            $this->group($this->getRouteAttributes(), function () {
27
                $this->get('reset', 'ForgotPasswordController@showLinkRequestForm')
28
                     ->name('get'); // auth::password.get
29
30
                $this->post('email', 'ForgotPasswordController@sendResetLinkEmail')
31
                     ->name('email'); // auth::password.email
32
33
                $this->get('reset/{token}', 'ResetPasswordController@showResetForm')
34
                     ->name('token'); // auth::password.token
35
36
                $this->post('reset', 'ResetPasswordController@reset')
37
                     ->name('post'); // auth::password.post
38
            });
39
        }
40
    }
41
42
    /* ------------------------------------------------------------------------------------------------
43
     |  Other Functions
44
     | ------------------------------------------------------------------------------------------------
45
     */
46
    /**
47
     * Check if enabled.
48
     *
49
     * @return bool
50
     */
51
    protected function isEnabled()
52
    {
53
        return config('arcanesoft.auth.authentication.enabled.password', false);
54
    }
55
56
    /**
57
     * Get the route attributes.
58
     *
59
     * @return array
60
     */
61
    protected function getRouteAttributes()
62
    {
63
        return array_merge([
64
            'prefix' => 'password',
65
            'as'     => 'password.',
66
        ], config('arcanesoft.auth.authentication.routes.password', []));
67
    }
68
}
69