Commit d3bf13b1 authored by Taylor Otwell's avatar Taylor Otwell

Working on routing and providers.

parent 5bb07523
...@@ -4,19 +4,17 @@ class HomeController { ...@@ -4,19 +4,17 @@ class HomeController {
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Default Home Controller | Home Controller
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| You may wish to use controllers instead of, or in addition to, Closure | Controller methods are called when a request enters the application
| based routes. That's great! Here is an example controller method to | with their assigned URI. The URI a method responds to may be set
| get you started. To route to this controller, just add the route: | via simple annotations. Here is an example to get you started!
|
| $router->get('/', 'HomeController@index');
| |
*/ */
/** /**
* @Get("/", as="home") * @Get("/")
*/ */
public function index() public function index()
{ {
......
<?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');
...@@ -15,4 +15,13 @@ class EventServiceProvider extends ServiceProvider { ...@@ -15,4 +15,13 @@ class EventServiceProvider extends ServiceProvider {
], ],
]; ];
/**
* The classes to scan for event annotations.
*
* @var array
*/
protected $scan = [
//
];
} }
<?php namespace App\Providers; <?php namespace App\Providers;
use Illuminate\Routing\Router; use Illuminate\Routing\Router;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider { class RouteServiceProvider extends ServiceProvider {
/**
* The root controller namespace for URL generation.
*
* @var string
*/
protected $rootUrlNamespace = 'App\Http\Controllers';
/**
* The controllers to scan for route annotations.
*
* @var array
*/
protected $scan = [
'App\Http\Controllers\HomeController',
'App\Http\Controllers\Auth\AuthController',
'App\Http\Controllers\Auth\PasswordController',
];
/** /**
* Called before routes are registered. * Called before routes are registered.
* *
* Register any model bindings or pattern based filters. * Register any model bindings or pattern based filters.
* *
* @param Router $router * @param Router $router
* @param UrlGenerator $url
* @return void * @return void
*/ */
public function before(Router $router, UrlGenerator $url) public function before(Router $router)
{ {
$url->setRootControllerNamespace('App\Http\Controllers'); //
} }
/** /**
...@@ -25,18 +41,9 @@ class RouteServiceProvider extends ServiceProvider { ...@@ -25,18 +41,9 @@ class RouteServiceProvider extends ServiceProvider {
* *
* @return void * @return void
*/ */
public function map() public function map(Router $router)
{ {
// Once the application has booted, we will include the default routes //
// file. This "namespace" helper will load the routes file within a
// route group which automatically sets the controller namespace.
$this->app->booted(function()
{
$this->namespaced('App\Http\Controllers', function(Router $router)
{
require app_path().'/Http/routes.php';
});
});
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment