Skip to content

Commit

Permalink
Routes + binding
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Jan 2, 2016
1 parent 06d47cd commit d2816ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/Http/Controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Facades\Request;
use TypiCMS\Modules\Core\Http\Controllers\BaseApiController;
use TypiCMS\Modules\Places\Models\Place;
use TypiCMS\Modules\Places\Repositories\PlaceInterface as Repository;

class ApiController extends BaseApiController
Expand Down
24 changes: 8 additions & 16 deletions src/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ class RouteServiceProvider extends ServiceProvider
*/
protected $namespace = 'TypiCMS\Modules\Places\Http\Controllers';

/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function boot(Router $router)
{
parent::boot($router);

$router->model('places', 'TypiCMS\Modules\Places\Models\Place');
}

/**
* Define the routes for the application.
*
Expand Down Expand Up @@ -58,12 +44,18 @@ public function map(Router $router)
/*
* Admin routes
*/
$router->resource('admin/places', 'AdminController');
$router->get('admin/places', ['as' => 'admin.places.index', 'uses' => 'AdminController@index']);
$router->get('admin/places/create', ['as' => 'admin.places.create', 'uses' => 'AdminController@create']);
$router->get('admin/places/{place}/edit', ['as' => 'admin.places.edit', 'uses' => 'AdminController@edit']);
$router->post('admin/places', ['as' => 'admin.places.store', 'uses' => 'AdminController@store']);
$router->put('admin/places/{place}', ['as' => 'admin.places.update', 'uses' => 'AdminController@update']);

/*
* API routes
*/
$router->resource('api/places', 'ApiController');
$router->get('api/places', ['as' => 'api.places.index', 'uses' => 'ApiController@index']);
$router->put('api/places/{place}', ['as' => 'api.places.update', 'uses' => 'ApiController@update']);
$router->delete('api/places/{place}', ['as' => 'api.places.destroy', 'uses' => 'ApiController@destroy']);
});
}
}

0 comments on commit d2816ff

Please sign in to comment.