Last active
January 9, 2017 06:39
-
-
Save yugo412/1aa2d3889adb2049957a222dfb1dfb82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// routes/web/blog.php | |
Route::get('index', 'BlogController@index')->name('blog.index'); | |
Route::get('about', 'BlogController@about')->name('blog.post'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// routes/web/page.php | |
Route::get('index', 'PageController@index')->name('page.index'); | |
Route::get('about', 'PageController@about')->name('page.about'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// app/Providers/RouteServiceProvider.php | |
namespace App\Providers; | |
use Illuminate\Support\Facades\Route; | |
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; | |
class RouteServiceProvider extends ServiceProvider | |
{ | |
/** | |
* This namespace is applied to your controller routes. | |
* | |
* In addition, it is set as the URL generator's root namespace. | |
* | |
* @var string | |
*/ | |
protected $namespace = 'App\Http\Controllers'; | |
/** | |
* Define your route model bindings, pattern filters, etc. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
// | |
parent::boot(); | |
} | |
/** | |
* Define the routes for the application. | |
* | |
* @return void | |
*/ | |
public function map() | |
{ | |
$this->mapApiRoutes(); | |
$this->mapWebRoutes(); | |
// | |
} | |
/** | |
* Define the "web" routes for the application. | |
* | |
* These routes all receive session state, CSRF protection, etc. | |
* | |
* @return void | |
*/ | |
protected function mapWebRoutes() | |
{ | |
Route::group([ | |
'middleware' => 'web', | |
'namespace' => $this->namespace, | |
], function ($router) { | |
require base_path('routes/web.php'); | |
require base_path('routes/web/page.php'); | |
require base_path('routes/web/blog.php'); | |
}); | |
} | |
/** | |
* Define the "api" routes for the application. | |
* | |
* These routes are typically stateless. | |
* | |
* @return void | |
*/ | |
protected function mapApiRoutes() | |
{ | |
Route::group([ | |
'middleware' => 'api', | |
'namespace' => $this->namespace, | |
'prefix' => 'api', | |
], function ($router) { | |
require base_path('routes/api.php'); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment