@@ -13,38 +13,42 @@ class AuthRouteMethods
13
13
public function auth ()
14
14
{
15
15
return function ($ options = []) {
16
- // Login Routes...
17
- if ($ options ['login ' ] ?? true ) {
18
- $ this ->get ('login ' , 'Auth\LoginController@showLoginForm ' )->name ('login ' );
19
- $ this ->post ('login ' , 'Auth\LoginController@login ' );
20
- }
21
-
22
- // Logout Routes...
23
- if ($ options ['logout ' ] ?? true ) {
24
- $ this ->post ('logout ' , 'Auth\LoginController@logout ' )->name ('logout ' );
25
- }
16
+ $ namespace = class_exists ($ this ->prependGroupNamespace ('Auth\LoginController ' )) ? null : 'App\Http\Controllers ' ;
26
17
27
- // Registration Routes...
28
- if ($ options ['register ' ] ?? true ) {
29
- $ this ->get ('register ' , 'Auth\RegisterController@showRegistrationForm ' )->name ('register ' );
30
- $ this ->post ('register ' , 'Auth\RegisterController@register ' );
31
- }
18
+ $ this ->group (['namespace ' => $ namespace ], function () use ($ options ) {
19
+ // Login Routes...
20
+ if ($ options ['login ' ] ?? true ) {
21
+ $ this ->get ('login ' , 'Auth\LoginController@showLoginForm ' )->name ('login ' );
22
+ $ this ->post ('login ' , 'Auth\LoginController@login ' );
23
+ }
32
24
33
- // Password Reset Routes...
34
- if ($ options ['reset ' ] ?? true ) {
35
- $ this ->resetPassword ( );
36
- }
25
+ // Logout Routes...
26
+ if ($ options ['logout ' ] ?? true ) {
27
+ $ this ->post ( ' logout ' , ' Auth\LoginController@logout ' )-> name ( ' logout ' );
28
+ }
37
29
38
- // Password Confirmation Routes...
39
- if ($ options ['confirm ' ] ??
40
- class_exists ( $ this ->prependGroupNamespace ( ' Auth\ConfirmPasswordController ' ))) {
41
- $ this ->confirmPassword ( );
42
- }
30
+ // Registration Routes...
31
+ if ($ options ['register ' ] ?? true ) {
32
+ $ this ->get ( ' register ' , ' Auth\RegisterController@showRegistrationForm ' )-> name ( ' register ' );
33
+ $ this ->post ( ' register ' , ' Auth\RegisterController@register ' );
34
+ }
43
35
44
- // Email Verification Routes...
45
- if ($ options ['verify ' ] ?? false ) {
46
- $ this ->emailVerification ();
47
- }
36
+ // Password Reset Routes...
37
+ if ($ options ['reset ' ] ?? true ) {
38
+ $ this ->resetPassword ();
39
+ }
40
+
41
+ // Password Confirmation Routes...
42
+ if ($ options ['confirm ' ] ??
43
+ class_exists ($ this ->prependGroupNamespace ('Auth\ConfirmPasswordController ' ))) {
44
+ $ this ->confirmPassword ();
45
+ }
46
+
47
+ // Email Verification Routes...
48
+ if ($ options ['verify ' ] ?? false ) {
49
+ $ this ->emailVerification ();
50
+ }
51
+ });
48
52
};
49
53
}
50
54
0 commit comments