Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
0ee0c434
Commit
0ee0c434
authored
Nov 02, 2014
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing default routing setup.
parent
aa8bf8a2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
47 deletions
+65
-47
AuthController.php
app/Http/Controllers/AuthController.php
+8
-20
Controller.php
app/Http/Controllers/Controller.php
+10
-0
HomeController.php
app/Http/Controllers/HomeController.php
+6
-9
PasswordController.php
app/Http/Controllers/PasswordController.php
+7
-17
routes.php
app/Http/routes.php
+30
-0
RouteServiceProvider.php
app/Providers/RouteServiceProvider.php
+4
-1
No files found.
app/Http/Controllers/Auth
/Auth
Controller.php
→
app/Http/Controllers/AuthController.php
View file @
0ee0c434
<?php
namespace
App\Http\Controllers
\Auth
;
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Routing\Controller
;
use
Illuminate\Contracts\Auth\Guard
;
use
Illuminate\Contracts\Auth\Guard
;
use
App\Http\Requests\Auth\LoginRequest
;
use
App\Http\Requests\Auth\LoginRequest
;
use
App\Http\Requests\Auth\RegisterRequest
;
use
App\Http\Requests\Auth\RegisterRequest
;
/**
* @Middleware("guest", except={"logout"})
*/
class
AuthController
extends
Controller
{
class
AuthController
extends
Controller
{
/**
/**
...
@@ -26,16 +22,16 @@ class AuthController extends Controller {
...
@@ -26,16 +22,16 @@ class AuthController extends Controller {
public
function
__construct
(
Guard
$auth
)
public
function
__construct
(
Guard
$auth
)
{
{
$this
->
auth
=
$auth
;
$this
->
auth
=
$auth
;
$this
->
middleware
(
'guest'
,
[
'except'
=>
'logout'
]);
}
}
/**
/**
* Show the application registration form.
* Show the application registration form.
*
*
* @Get("auth/register")
*
* @return Response
* @return Response
*/
*/
public
function
showRegistrationForm
()
public
function
getRegister
()
{
{
return
view
(
'auth.register'
);
return
view
(
'auth.register'
);
}
}
...
@@ -43,12 +39,10 @@ class AuthController extends Controller {
...
@@ -43,12 +39,10 @@ class AuthController extends Controller {
/**
/**
* Handle a registration request for the application.
* Handle a registration request for the application.
*
*
* @Post("auth/register")
*
* @param RegisterRequest $request
* @param RegisterRequest $request
* @return Response
* @return Response
*/
*/
public
function
r
egister
(
RegisterRequest
$request
)
public
function
postR
egister
(
RegisterRequest
$request
)
{
{
// Registration form is valid, create user...
// Registration form is valid, create user...
...
@@ -60,11 +54,9 @@ class AuthController extends Controller {
...
@@ -60,11 +54,9 @@ class AuthController extends Controller {
/**
/**
* Show the application login form.
* Show the application login form.
*
*
* @Get("auth/login")
*
* @return Response
* @return Response
*/
*/
public
function
showLoginForm
()
public
function
getLogin
()
{
{
return
view
(
'auth.login'
);
return
view
(
'auth.login'
);
}
}
...
@@ -72,12 +64,10 @@ class AuthController extends Controller {
...
@@ -72,12 +64,10 @@ class AuthController extends Controller {
/**
/**
* Handle a login request to the application.
* Handle a login request to the application.
*
*
* @Post("auth/login")
*
* @param LoginRequest $request
* @param LoginRequest $request
* @return Response
* @return Response
*/
*/
public
function
l
ogin
(
LoginRequest
$request
)
public
function
postL
ogin
(
LoginRequest
$request
)
{
{
if
(
$this
->
auth
->
attempt
(
$request
->
only
(
'email'
,
'password'
)))
if
(
$this
->
auth
->
attempt
(
$request
->
only
(
'email'
,
'password'
)))
{
{
...
@@ -92,11 +82,9 @@ class AuthController extends Controller {
...
@@ -92,11 +82,9 @@ class AuthController extends Controller {
/**
/**
* Log the user out of the application.
* Log the user out of the application.
*
*
* @Get("auth/logout")
*
* @return Response
* @return Response
*/
*/
public
function
l
ogout
()
public
function
getL
ogout
()
{
{
$this
->
auth
->
logout
();
$this
->
auth
->
logout
();
...
...
app/Http/Controllers/Controller.php
0 → 100644
View file @
0ee0c434
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Routing\Controller
as
BaseController
;
use
Illuminate\Foundation\Validation\ValidatesRequests
;
abstract
class
Controller
extends
BaseController
{
use
ValidatesRequests
;
}
app/Http/Controllers/HomeController.php
View file @
0ee0c434
<?php
namespace
App\Http\Controllers
;
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Routing\Controller
;
class
HomeController
extends
Controller
{
class
HomeController
extends
Controller
{
/*
/*
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
| Home Controller
|
Default
Home Controller
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
|
|
| Controller methods are called when a request enters the application
| You may wish to use controllers instead of, or in addition to, Closure
| with their assigned URI. The URI a method responds to may be set
| based routes. That's great! Here is an example controller method to
| via simple annotations. Here is an example to get you started!
| get you started. To route to this controller, just add the route:
|
| $router->get('/', 'HomeController@showWelcome');
|
|
*/
*/
/**
* @Get("/")
*/
public
function
index
()
public
function
index
()
{
{
return
view
(
'hello'
);
return
view
(
'hello'
);
...
...
app/Http/Controllers/
Auth/
PasswordController.php
→
app/Http/Controllers/PasswordController.php
View file @
0ee0c434
<?php
namespace
App\Http\Controllers
\Auth
;
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Routing\Controller
;
use
Illuminate\Contracts\Auth\PasswordBroker
;
use
Illuminate\Contracts\Auth\PasswordBroker
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
/**
* @Middleware("guest")
*/
class
PasswordController
extends
Controller
{
class
PasswordController
extends
Controller
{
/**
/**
...
@@ -26,16 +22,16 @@ class PasswordController extends Controller {
...
@@ -26,16 +22,16 @@ class PasswordController extends Controller {
public
function
__construct
(
PasswordBroker
$passwords
)
public
function
__construct
(
PasswordBroker
$passwords
)
{
{
$this
->
passwords
=
$passwords
;
$this
->
passwords
=
$passwords
;
$this
->
middleware
(
'guest'
);
}
}
/**
/**
* Display the form to request a password reset link.
* Display the form to request a password reset link.
*
*
* @Get("password/email")
*
* @return Response
* @return Response
*/
*/
public
function
showResetRequestForm
()
public
function
getEmail
()
{
{
return
view
(
'password.email'
);
return
view
(
'password.email'
);
}
}
...
@@ -43,12 +39,10 @@ class PasswordController extends Controller {
...
@@ -43,12 +39,10 @@ class PasswordController extends Controller {
/**
/**
* Send a reset link to the given user.
* Send a reset link to the given user.
*
*
* @Post("password/email")
*
* @param Request $request
* @param Request $request
* @return Response
* @return Response
*/
*/
public
function
sendResetLink
(
Request
$request
)
public
function
postEmail
(
Request
$request
)
{
{
switch
(
$response
=
$this
->
passwords
->
sendResetLink
(
$request
->
only
(
'email'
)))
switch
(
$response
=
$this
->
passwords
->
sendResetLink
(
$request
->
only
(
'email'
)))
{
{
...
@@ -63,12 +57,10 @@ class PasswordController extends Controller {
...
@@ -63,12 +57,10 @@ class PasswordController extends Controller {
/**
/**
* Display the password reset view for the given token.
* Display the password reset view for the given token.
*
*
* @Get("password/reset/{token}")
*
* @param string $token
* @param string $token
* @return Response
* @return Response
*/
*/
public
function
showResetForm
(
$token
=
null
)
public
function
getReset
(
$token
=
null
)
{
{
if
(
is_null
(
$token
))
if
(
is_null
(
$token
))
{
{
...
@@ -81,12 +73,10 @@ class PasswordController extends Controller {
...
@@ -81,12 +73,10 @@ class PasswordController extends Controller {
/**
/**
* Reset the given user's password.
* Reset the given user's password.
*
*
* @Post("password/reset")
*
* @param Request $request
* @param Request $request
* @return Response
* @return Response
*/
*/
public
function
resetPassword
(
Request
$request
)
public
function
postReset
(
Request
$request
)
{
{
$credentials
=
$request
->
only
(
$credentials
=
$request
->
only
(
'email'
,
'password'
,
'password_confirmation'
,
'token'
'email'
,
'password'
,
'password_confirmation'
,
'token'
...
...
app/Http/routes.php
0 → 100644
View file @
0ee0c434
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
$router
->
get
(
'/'
,
'HomeController@index'
);
/*
|--------------------------------------------------------------------------
| Authentication & Password Reset Controllers
|--------------------------------------------------------------------------
|
| These two controllers handle the authentication of the users of your
| application, as well as the functions necessary for resetting the
| passwords for your users. You may modify or remove these files
| if you wish. They just give you a convenient starting point.
|
*/
$router
->
controller
(
'auth'
,
'AuthController'
);
$router
->
controller
(
'password'
,
'PasswordController'
);
app/Providers/RouteServiceProvider.php
View file @
0ee0c434
...
@@ -49,7 +49,10 @@ class RouteServiceProvider extends ServiceProvider {
...
@@ -49,7 +49,10 @@ class RouteServiceProvider extends ServiceProvider {
*/
*/
public
function
map
(
Router
$router
)
public
function
map
(
Router
$router
)
{
{
// require app_path('Http/routes.php');
$router
->
group
([
'namespace'
=>
'App\Http\Controllers'
],
function
(
$router
)
{
require
app_path
(
'Http/routes.php'
);
});
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment