2016-12-14 04:32:10 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| API Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Here is where you can register API routes for your application. These
|
|
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
|
|
| is assigned the "api" middleware group. Enjoy building your API!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-12-14 10:54:05 -08:00
|
|
|
|
2017-01-12 23:41:08 -08:00
|
|
|
Route::group(['prefix' => 'v1','namespace' => 'Api'], function () {
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Accessories API ---*/
|
2017-01-25 21:29:23 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::resource('accessories', 'AccessoriesController',
|
2017-01-25 21:29:23 -08:00
|
|
|
['names' =>
|
|
|
|
[
|
2017-02-23 16:32:35 -08:00
|
|
|
'index' => 'api.accessories.index',
|
|
|
|
'show' => 'api.accessories.show',
|
|
|
|
'update' => 'api.accessories.update',
|
|
|
|
'store' => 'api.accessories.store',
|
|
|
|
'destroy' => 'api.accessories.destroy'
|
2017-01-25 21:29:23 -08:00
|
|
|
],
|
2017-02-23 16:32:35 -08:00
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['accessory' => 'accessory_id']
|
2017-01-25 21:29:23 -08:00
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Accessories resource
|
2017-01-24 18:58:07 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'accessories'], function () {
|
2017-01-24 18:58:07 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('{accessory}/checkedout',
|
|
|
|
[
|
|
|
|
'as' => 'api.accessories.checkedout',
|
|
|
|
'uses' => 'AccessoriesController@checkedout'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}); // Accessories group
|
2017-01-26 21:02:59 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Categories API ---*/
|
2017-01-13 04:50:20 -08:00
|
|
|
|
2017-01-13 09:01:10 -08:00
|
|
|
Route::resource('categories', 'CategoriesController',
|
2017-02-23 16:32:35 -08:00
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.categories.index',
|
|
|
|
'show' => 'api.categories.show',
|
|
|
|
'store' => 'api.categories.store',
|
|
|
|
'update' => 'api.categories.update',
|
|
|
|
'destroy' => 'api.categories.destroy'
|
|
|
|
],
|
2017-01-13 09:01:10 -08:00
|
|
|
'except' => ['edit', 'create'],
|
|
|
|
'parameters' => ['category' => 'category_id']
|
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Categories resource
|
|
|
|
|
2017-01-13 04:50:20 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Companies API ---*/
|
2017-01-13 04:50:20 -08:00
|
|
|
|
2017-01-12 23:41:08 -08:00
|
|
|
Route::resource('companies', 'CompaniesController',
|
2017-02-23 16:32:35 -08:00
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.companies.index',
|
|
|
|
'show' => 'api.companies.show',
|
|
|
|
'store' => 'api.companies.store',
|
|
|
|
'update' => 'api.companies.update',
|
|
|
|
'destroy' => 'api.companies.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
2017-01-12 23:41:08 -08:00
|
|
|
'parameters' => ['component' => 'component_id']
|
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Companies resource
|
2017-01-12 19:41:01 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Components API ---*/
|
2017-01-12 19:41:01 -08:00
|
|
|
|
2017-01-12 23:41:08 -08:00
|
|
|
Route::resource('components', 'ComponentsController',
|
2017-02-23 16:32:35 -08:00
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.components.index',
|
|
|
|
'show' => 'api.components.show',
|
|
|
|
'store' => 'api.components.store',
|
|
|
|
'update' => 'api.components.update',
|
|
|
|
'destroy' => 'api.components.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['component' => 'component_id']
|
2017-01-12 19:41:01 -08:00
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Components resource
|
2017-01-12 19:41:01 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'components'], function () {
|
2017-02-21 14:26:46 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('{component}/assets',
|
2017-01-12 19:41:01 -08:00
|
|
|
[
|
2017-02-23 16:32:35 -08:00
|
|
|
'as' =>'api.components.assets',
|
|
|
|
'uses' => 'ComponentsController@getAssets',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}); // Components group
|
2017-01-12 19:41:01 -08:00
|
|
|
|
2017-02-01 17:59:03 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Consumables API ---*/
|
|
|
|
|
|
|
|
Route::resource('consumables', 'ConsumablesController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.consumables.index',
|
|
|
|
'show' => 'api.consumables.show',
|
|
|
|
'store' => 'api.consumables.store',
|
|
|
|
'update' => 'api.consumables.update',
|
|
|
|
'destroy' => 'api.consumables.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['consumable' => 'consumable_id']
|
2017-02-01 18:50:28 -08:00
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Consumables resource
|
|
|
|
|
2017-02-01 18:50:28 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Depreciations API ---*/
|
2017-02-01 18:50:28 -08:00
|
|
|
|
2017-02-01 17:59:03 -08:00
|
|
|
Route::resource('depreciations', 'DepreciationsController',
|
2017-02-23 16:32:35 -08:00
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.depreciations.index',
|
|
|
|
'show' => 'api.depreciations.show',
|
|
|
|
'store' => 'api.depreciations.store',
|
|
|
|
'update' => 'api.depreciations.update',
|
|
|
|
'destroy' => 'api.depreciations.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['depreciation' => 'depreciation_id']
|
2017-02-01 17:59:03 -08:00
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Depreciations resource
|
2017-02-01 17:59:03 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Fields API ---*/
|
2017-01-12 19:41:01 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'fields'], function () {
|
|
|
|
Route::post('fieldsets/{id}/order',
|
2017-01-12 19:41:01 -08:00
|
|
|
[
|
2017-02-23 16:32:35 -08:00
|
|
|
'as' => 'api.customfields.order',
|
|
|
|
'uses' => 'CustomFieldsController@postReorder'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}); // Fields group
|
|
|
|
|
|
|
|
|
|
|
|
/*--- Groups API ---*/
|
|
|
|
|
|
|
|
Route::resource('groups', 'GroupsController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.groups.index',
|
|
|
|
'show' => 'api.groups.show',
|
|
|
|
'store' => 'api.groups.store',
|
|
|
|
'update' => 'api.groups.update',
|
|
|
|
'destroy' => 'api.groups.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['group' => 'group_id']
|
2017-01-12 19:41:01 -08:00
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Groups resource
|
2017-01-12 19:41:01 -08:00
|
|
|
|
2017-01-13 03:19:39 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Hardware API ---*/
|
2017-02-01 17:59:03 -08:00
|
|
|
|
2017-03-11 14:04:52 -08:00
|
|
|
Route::group(['prefix' => 'hardware'], function () {
|
|
|
|
|
2017-03-11 15:25:19 -08:00
|
|
|
Route::post('{asset_id}/checkout',
|
2017-03-11 14:04:52 -08:00
|
|
|
[
|
|
|
|
'as' => 'api.assets.checkout',
|
|
|
|
'uses' => 'AssetsController@checkout'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
2017-03-11 15:25:19 -08:00
|
|
|
Route::post('{asset_id}/checkin',
|
2017-03-11 14:04:52 -08:00
|
|
|
[
|
|
|
|
'as' => 'api.assets.checkin',
|
|
|
|
'uses' => 'AssetsController@checkin'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::resource('hardware', 'AssetsController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.assets.index',
|
|
|
|
'show' => 'api.assets.show',
|
|
|
|
'store' => 'api.assets.store',
|
|
|
|
'update' => 'api.assets.update',
|
|
|
|
'destroy' => 'api.assets.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['asset' => 'asset_id']
|
|
|
|
]
|
|
|
|
); // Hardware resource
|
2017-02-01 17:59:03 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Imports API ---*/
|
2017-01-13 03:19:39 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::resource('imports', 'ImportController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.imports.index',
|
|
|
|
'show' => 'api.imports.show',
|
|
|
|
'store' => 'api.imports.store',
|
|
|
|
'update' => 'api.imports.update',
|
|
|
|
'destroy' => 'api.imports.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['import' => 'import_id']
|
|
|
|
]
|
|
|
|
); // Imports resource
|
2017-01-13 03:19:39 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'imports'], function () {
|
2017-01-18 20:41:40 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::post('process/{import}',
|
|
|
|
[
|
|
|
|
'as' => 'api.imports.importFile',
|
|
|
|
'uses'=> 'ImportController@process'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}); // Imports group
|
2017-01-13 03:19:39 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Licenses API ---*/
|
2017-01-13 03:19:39 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::resource('licenses', 'LicensesController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.licenses.index',
|
|
|
|
'show' => 'api.licenses.show',
|
|
|
|
'store' => 'api.licenses.store',
|
|
|
|
'update' => 'api.licenses.update',
|
|
|
|
'destroy' => 'api.licenses.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['license' => 'license_id']
|
|
|
|
]
|
|
|
|
); // Licenses resource
|
2017-01-13 03:19:39 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
|
|
|
|
/*--- Locations API ---*/
|
|
|
|
|
|
|
|
Route::resource('locations', 'LocationsController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.locations.index',
|
|
|
|
'show' => 'api.locations.show',
|
|
|
|
'store' => 'api.locations.store',
|
|
|
|
'update' => 'api.locations.update',
|
|
|
|
'destroy' => 'api.locations.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['location' => 'location_id']
|
2017-01-12 19:41:01 -08:00
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Locations resource
|
2017-01-12 19:41:01 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'locations'], function () {
|
2017-01-13 03:19:39 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('{location}/users',
|
|
|
|
[
|
|
|
|
'as'=>'api.locations.viewusers',
|
|
|
|
'uses'=>'LocationsController@getDataViewUsers'
|
|
|
|
]
|
|
|
|
);
|
2017-01-13 03:19:39 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('{location}/assets',
|
2017-01-12 19:41:01 -08:00
|
|
|
[
|
2017-02-23 16:32:35 -08:00
|
|
|
'as'=>'api.locations.viewassets',
|
|
|
|
'uses'=>'LocationsController@getDataViewAssets'
|
|
|
|
]
|
|
|
|
);
|
2017-01-12 19:41:01 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
// Do we actually still need this, now that we have an API?
|
|
|
|
Route::get('{location}/check',
|
2017-01-12 19:41:01 -08:00
|
|
|
[
|
2017-02-23 16:32:35 -08:00
|
|
|
'as' => 'api.locations.check',
|
|
|
|
'uses' => 'LocationsController@show'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}); // Locations group
|
|
|
|
|
|
|
|
|
|
|
|
/*--- Manufacturers API ---*/
|
|
|
|
|
|
|
|
Route::resource('manufacturers', 'ManufacturersController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.manufacturers.index',
|
|
|
|
'show' => 'api.manufacturers.show',
|
|
|
|
'store' => 'api.manufacturers.store',
|
|
|
|
'update' => 'api.manufacturers.update',
|
|
|
|
'destroy' => 'api.manufacturers.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
2017-01-13 09:37:06 -08:00
|
|
|
'parameters' => ['manufacturer' => 'manufacturer_id']
|
2017-01-12 19:41:01 -08:00
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Manufacturers resource
|
2017-01-12 19:41:01 -08:00
|
|
|
|
2017-01-25 02:19:26 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Models API ---*/
|
2017-01-25 02:19:26 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::resource('models', 'AssetModelsController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.models.index',
|
|
|
|
'show' => 'api.models.show',
|
|
|
|
'store' => 'api.models.store',
|
|
|
|
'update' => 'api.models.update',
|
|
|
|
'destroy' => 'api.models.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['model' => 'model_id']
|
|
|
|
]
|
|
|
|
); // Models resource
|
2017-01-25 02:19:26 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'models'], function () {
|
2017-01-25 02:19:26 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('assets',
|
2017-01-12 19:41:01 -08:00
|
|
|
[
|
2017-02-23 16:32:35 -08:00
|
|
|
'as' => 'api.models.assets',
|
|
|
|
'uses'=> 'AssetModelsController@assets'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}); // Models group
|
|
|
|
|
|
|
|
|
|
|
|
/*--- Settings API ---*/
|
|
|
|
|
|
|
|
Route::resource('settings', 'SettingsController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.settings.index',
|
|
|
|
'store' => 'api.settings.store',
|
|
|
|
'show' => 'api.settings.show',
|
|
|
|
'update' => 'api.settings.update'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit', 'destroy'],
|
|
|
|
'parameters' => ['setting' => 'setting_id']
|
2017-01-12 19:41:01 -08:00
|
|
|
]
|
2017-02-23 16:32:35 -08:00
|
|
|
); // Settings resource
|
2017-01-12 19:41:01 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Status Labels API ---*/
|
2017-01-12 19:41:01 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'statuslabels'], function () {
|
2017-01-12 02:20:32 -08:00
|
|
|
|
2017-04-06 21:18:35 -07:00
|
|
|
// Pie chart for dashboard
|
|
|
|
Route::get('assets',
|
|
|
|
[
|
|
|
|
'as' => 'api.statuslabels.assets.bytype',
|
|
|
|
'uses' => 'StatuslabelsController@getAssetCountByStatuslabel'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('{statuslabel}/assetlist',
|
|
|
|
[
|
|
|
|
'as' => 'api.statuslabels.assets',
|
|
|
|
'uses' => 'StatuslabelsController@assets'
|
|
|
|
]
|
|
|
|
);
|
2017-01-11 18:14:06 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('{statuslabel}/deployable',
|
|
|
|
[
|
|
|
|
'as' => 'api.statuslabels.deployable',
|
|
|
|
'uses' => 'StatuslabelsController@checkIfDeployable'
|
|
|
|
]
|
|
|
|
);
|
2017-01-11 18:14:06 -08:00
|
|
|
|
2017-04-06 21:18:35 -07:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
Route::resource('statuslabels', 'StatuslabelsController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.statuslabels.index',
|
|
|
|
'store' => 'api.statuslabels.store',
|
|
|
|
'show' => 'api.statuslabels.show',
|
|
|
|
'update' => 'api.statuslabels.update',
|
|
|
|
'destroy' => 'api.statuslabels.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['statuslabel' => 'statuslabel_id']
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
// Status labels group
|
2017-01-11 18:14:06 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Suppliers API ---*/
|
2017-01-12 23:41:08 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::resource('suppliers', 'SuppliersController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.suppliers.index',
|
|
|
|
'show' => 'api.suppliers.show',
|
|
|
|
'store' => 'api.suppliers.store',
|
|
|
|
'update' => 'api.suppliers.update',
|
|
|
|
'destroy' => 'api.suppliers.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['supplier' => 'supplier_id']
|
|
|
|
]
|
|
|
|
); // Suppliers resource
|
2017-01-24 17:37:07 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'suppliers'], function () {
|
2017-01-24 17:37:07 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('list',
|
|
|
|
[
|
|
|
|
'as'=>'api.suppliers.list',
|
|
|
|
'uses'=>'SuppliersController@getDatatable'
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}); // Suppliers group
|
2016-12-14 10:54:05 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
/*--- Users API ---*/
|
2016-12-14 10:54:05 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::resource('users', 'UsersController',
|
|
|
|
[
|
|
|
|
'names' =>
|
|
|
|
[
|
|
|
|
'index' => 'api.users.index',
|
|
|
|
'show' => 'api.users.show',
|
|
|
|
'store' => 'api.users.store',
|
|
|
|
'update' => 'api.users.update',
|
|
|
|
'destroy' => 'api.users.destroy'
|
|
|
|
],
|
|
|
|
'except' => ['create', 'edit'],
|
|
|
|
'parameters' => ['user' => 'user_id']
|
|
|
|
]
|
|
|
|
); // Users resource
|
2016-12-14 10:54:05 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group([ 'prefix' => 'users' ], function () {
|
2017-01-12 23:41:08 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::post('two_factor_reset',
|
|
|
|
[
|
|
|
|
'as' => 'api.users.two_factor_reset',
|
|
|
|
'uses' => 'UsersController@postTwoFactorReset'
|
|
|
|
]
|
|
|
|
);
|
2016-12-14 10:54:05 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('list/{status?}',
|
|
|
|
[
|
|
|
|
'as' => 'api.users.list',
|
|
|
|
'uses' => 'UsersController@getDatatable'
|
|
|
|
]
|
|
|
|
);
|
2016-12-14 10:54:05 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('{user}/assets',
|
|
|
|
[
|
|
|
|
'as' => 'api.users.assetlist',
|
|
|
|
'uses' => 'UsersController@getAssetList'
|
|
|
|
]
|
|
|
|
);
|
2017-01-18 04:58:56 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::post('{user}/upload',
|
|
|
|
[
|
|
|
|
'as' => 'api.users.uploads',
|
|
|
|
'uses' => 'UsersController@postUpload'
|
|
|
|
]
|
2017-01-18 04:58:56 -08:00
|
|
|
);
|
2017-02-23 16:32:35 -08:00
|
|
|
}); // Users group
|
2017-01-18 04:58:56 -08:00
|
|
|
|
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
### DEBUG ROUTES ###
|
2017-01-18 04:58:56 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::group(['prefix' => 'me'], function () {
|
2017-01-18 04:58:56 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
if (env('APP_ENV') == 'production') {
|
|
|
|
abort(404);
|
|
|
|
}
|
2017-01-11 14:51:00 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('/profile', function () {
|
|
|
|
return json_encode([
|
|
|
|
'name' => \Auth::user()->first_name . ' ' . \Auth::user()->last_name,
|
|
|
|
'email' => \Auth::user()->email,
|
|
|
|
]);
|
|
|
|
});
|
2017-01-11 14:51:00 -08:00
|
|
|
|
2017-02-23 16:32:35 -08:00
|
|
|
Route::get('/authenticated', function () {
|
|
|
|
return json_encode([
|
|
|
|
'authenticated' => \Auth::check()
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Route::get('/permissions/{scope}/{action}', function ($scope, $action) {
|
|
|
|
return json_encode([
|
|
|
|
'permission' => $scope . '.' . $action,
|
|
|
|
'authorized' => \Auth::user()->hasAccess($scope . '.' . $action),
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Route::get('/permissions', function () {
|
|
|
|
return json_encode([
|
|
|
|
'permissions' => Auth::user()->permissions
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|