Skip to content

Commit

Permalink
Use container instead of facade alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
asvae committed Sep 8, 2016
1 parent dda8378 commit 0132f11
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
<?php

$router = app('router');

// Api-tester base route. This is entry point for frontend-SPA.
Route::get('/', [
$router->get('/', [
'as' => 'home',
'uses' => 'HomeController@index',
]);

// Fetch all Laravel routes.
Route::post('routes/index', 'RouteController@index');
$router->post('routes/index', 'RouteController@index');

Route::post('requests/index', 'RequestController@index');
Route::post('requests/store', 'RequestController@store');
Route::post('requests/update', 'RequestController@update');
Route::post('requests/destroy', 'RequestController@destroy');
$router->post('requests/index', 'RequestController@index');
$router->post('requests/store', 'RequestController@store');
$router->post('requests/update', 'RequestController@update');
$router->post('requests/destroy', 'RequestController@destroy');

// We won't publish library's assets.
// Instead we'll pass them via app which is slower but fine for development.
Route::group(['prefix' => 'assets'], function () {
$router->group(['prefix' => 'assets'], function ($router) {

$filePattern = '^([a-z0-9_\-\.]+)$';

Route::get('fonts/{_file}', [
$router->get('fonts/{_file}', [
'as' => 'image',
'uses' => 'AssetsController@font'
])->where('_file', $filePattern);

Route::get('img/{_file}', [
$router->get('img/{_file}', [
'as' => 'image', 'uses' => 'AssetsController@image'
])->where('_file', $filePattern);

Route::get('{_file}', [
$router->get('{_file}', [
'as' => 'file',
'uses' => 'AssetsController@index'
])->where('_file', $filePattern);
Expand All @@ -44,7 +46,7 @@
* This route is debug only, hence in production
* it isn't registered and route cache is allowed.
*/
Route::any('* routes should not be cached',[
$router->any('* routes should not be cached',[
'as' => 'routes-should not be cached',
'uses' => function () { return 'Api-tester routes-should not be cached';},
]);
Expand Down

0 comments on commit 0132f11

Please sign in to comment.