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 AuthenticationRoutes |
8
|
|
|
* |
9
|
|
|
* @package App\Http\Routes |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class AuthenticationRoutes 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->mapLoginRoutes(); |
27
|
|
|
$this->mapLogoutRoute(); |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
protected function mapLoginRoutes() |
32
|
|
|
{ |
33
|
|
|
$attributes = array_merge([ |
34
|
|
|
'prefix' => 'login', |
35
|
|
|
'as' => 'login.', |
36
|
|
|
], config('arcanesoft.auth.authentication.routes.login', [])); |
37
|
|
|
|
38
|
|
|
$this->group($attributes, function () { |
39
|
|
|
$this->get('/', [ |
40
|
|
|
'as' => 'get', // auth::login.get |
41
|
|
|
'uses' => 'LoginController@showLoginForm', |
42
|
|
|
]); |
43
|
|
|
|
44
|
|
|
$this->post('/', [ |
45
|
|
|
'as' => 'post', // auth::login.post |
46
|
|
|
'uses' => 'LoginController@login', |
47
|
|
|
]); |
48
|
|
|
}); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
protected function mapLogoutRoute() |
52
|
|
|
{ |
53
|
|
|
$attributes = array_merge([ |
54
|
|
|
'prefix' => 'logout', |
55
|
|
|
], config('arcanesoft.auth.authentication.routes.logout', [])); |
56
|
|
|
|
57
|
|
|
$this->group($attributes, function () { |
58
|
|
|
$this->post('/', [ |
59
|
|
|
'as' => 'logout', // auth::logout |
60
|
|
|
'uses' => 'LoginController@logout', |
61
|
|
|
]); |
62
|
|
|
}); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/* ------------------------------------------------------------------------------------------------ |
66
|
|
|
| Other Functions |
67
|
|
|
| ------------------------------------------------------------------------------------------------ |
68
|
|
|
*/ |
69
|
|
|
protected function isEnabled() |
70
|
|
|
{ |
71
|
|
|
return config('arcanesoft.auth.authentication.enabled.login-logout', false); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|