Skip to content

Commit

Permalink
Updating routes
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Mar 2, 2017
1 parent 0a1161b commit 29b864a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Http/Routes/Admin/ApiRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ApiRoutes extends RouteRegistrar
*/
public function map()
{
$this->prefix('api')->name('api.')->group(function () {
$this->name('api.')->group(function () {
$this->get('all', 'MediasController@getAll')
->name('get'); // admin::media.api.get

Expand Down
14 changes: 13 additions & 1 deletion src/Providers/PackagesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,17 @@
*/
class PackagesServiceProvider extends ServiceProvider
{
//
/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/
/**
* Register the service provider.
*/
public function register()
{
parent::register();

$this->registerProvider(\Arcanedev\LaravelApiHelper\ApiHelperServiceProvider::class);
}
}
19 changes: 12 additions & 7 deletions src/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class RouteServiceProvider extends ServiceProvider
public function map()
{
$this->adminGroup(function () {
$this->mapAdminRoutes();
$this->name('media.')->group(function () {
$this->mapAdminRoutes();
});
});
}

Expand All @@ -41,11 +43,14 @@ public function map()
*/
protected function mapAdminRoutes()
{
$this->name('media.')
->prefix($this->config()->get('arcanesoft.media.route.prefix', 'media'))
->group(function () {
Routes\Admin\MediaRoutes::register();
Routes\Admin\ApiRoutes::register(); // TODO: Adding `api` or `ajax` middleware ?
});
$prefix = $this->config()->get('arcanesoft.media.route.prefix', 'media');

$this->prefix($prefix)->group(function () {
Routes\Admin\MediaRoutes::register();
});

$this->prefix("api/{$prefix}")->middleware('ajax')->group(function () {
Routes\Admin\ApiRoutes::register();
});
}
}

0 comments on commit 29b864a

Please sign in to comment.