-
Notifications
You must be signed in to change notification settings - Fork 6
/
routes.php
executable file
·90 lines (63 loc) · 2.44 KB
/
routes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/*
|--------------------------------------------------------------------------
| Bundle Home Route
|--------------------------------------------------------------------------
*/
$bundle_route = '(:bundle)/';
if(Config::get('myauth::config.bundle_route') != ''){
Route::get($bundle_route, function(){
if (Auth::guest()){
return Redirect::to(Config::get('myauth::config.bundle_route') . '/' . Config::get('myauth::config.login_route'));
} else {
if(Config::get('myauth::config.login_redirect') != ''){
return Redirect::to(Config::get('myauth::config.login_redirect'));
} else {
return View::make('myauth::dashboard');
}
}
});
}
/*
|--------------------------------------------------------------------------
| Bundle Login Routes
|--------------------------------------------------------------------------
*/
$login_route = $bundle_route . Config::get('myauth::config.login_route');
Route::get($login_route, function(){ return View::make('myauth::login'); });
Route::post($login_route, 'myauth::user@login');
/*
|--------------------------------------------------------------------------
| Bundle Logout Route
|--------------------------------------------------------------------------
*/
$logout_route = $bundle_route . Config::get('myauth::config.logout_route');
Route::get($logout_route, function(){
Auth::logout();
return Redirect::to(Config::get('myauth::config.bundle_route') . '/' . Config::get('myauth::config.login_route'));
});
/*
|--------------------------------------------------------------------------
| Bundle Signup Routes
|--------------------------------------------------------------------------
*/
$signup_route = $bundle_route . Config::get('myauth::config.signup_route');
Route::get($signup_route, function(){ return View::make('myauth::signup'); });
Route::post($signup_route, 'myauth::user@signup');
/*
|--------------------------------------------------------------------------
| Bundle Dashboard Route
|--------------------------------------------------------------------------
*/
if(Config::get('myauth::config.login_redirect') != ''){
return Redirect::to(Config::get('myauth::config.login_redirect'));
} else {
$dashboard_route = $bundle_route . 'dashboard';
Route::get($dashboard_route, function(){
if (Auth::guest()){
return Redirect::to(Config::get('myauth::config.bundle_route') . '/' . Config::get('myauth::config.login_route'));
} else {
return View::make('myauth::dashboard');
}
});
}