snipe-it/routes/api.php
snipe 87464e6ec0
Merge branch 'develop' into integrations/2020-04-15-v5-merge
# Conflicts:
#	README.md
#	app/Http/Controllers/AccessoriesController.php
#	app/Http/Controllers/Api/AssetsController.php
#	app/Http/Controllers/Api/LicensesController.php
#	app/Http/Controllers/Api/LocationsController.php
#	app/Http/Controllers/Api/SettingsController.php
#	app/Http/Controllers/Api/UsersController.php
#	app/Http/Controllers/AssetModelsController.php
#	app/Http/Controllers/Assets/AssetsController.php
#	app/Http/Controllers/Auth/ForgotPasswordController.php
#	app/Http/Controllers/CategoriesController.php
#	app/Http/Controllers/CompaniesController.php
#	app/Http/Controllers/ComponentsController.php
#	app/Http/Controllers/ConsumablesController.php
#	app/Http/Controllers/CustomFieldsetsController.php
#	app/Http/Controllers/DepartmentsController.php
#	app/Http/Controllers/LicensesController.php
#	app/Http/Controllers/LocationsController.php
#	app/Http/Controllers/ManufacturersController.php
#	app/Http/Controllers/SettingsController.php
#	app/Http/Controllers/SuppliersController.php
#	app/Http/Controllers/UsersController.php
#	app/Http/Requests/AssetRequest.php
#	app/Http/Requests/ImageUploadRequest.php
#	app/Models/LicenseSeat.php
#	app/Models/Location.php
#	app/Models/Setting.php
#	composer.json
#	composer.lock
#	config/database.php
#	config/version.php
#	npm-shrinkwrap.json
#	package.json
#	public/css/AdminLTE.css
#	public/css/AdminLTE.css.map
#	public/css/overrides.css
#	public/css/overrides.css.map
#	public/css/skins/skin-blue-light.css
#	public/css/skins/skin-blue.css
#	public/css/skins/skin-green-dark.min.css
#	public/js/app.js
#	public/js/bootstrap-table.js
#	public/js/bootstrap/js/bootstrap.js
#	public/js/bootstrap/js/bootstrap.min.js
#	public/js/build/all.js
#	public/js/build/vue.js
#	public/js/build/vue.js.map
#	public/js/demo.js
#	public/js/ekko-lightbox.js
#	public/js/ekko-lightbox.min.js
#	public/js/extensions/export/bootstrap-table-export.js
#	public/js/extensions/multiple-sort/bootstrap-table-multiple-sort.js
#	public/js/extensions/multiple-sort/bootstrap-table-multiple-sort.min.js
#	public/js/extensions/toolbar/bootstrap-table-toolbar.min.js
#	public/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
#	public/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js
#	public/js/plugins/timepicker/bootstrap-timepicker.js
#	public/js/plugins/timepicker/bootstrap-timepicker.min.js
#	public/js/vue.js
#	public/mix-manifest.json
#	resources/assets/js/bootstrap-js.js
#	resources/assets/js/bootstrap.min.js
#	resources/assets/js/ekko-lightbox.js
#	resources/assets/js/ekko-lightbox.min.js
#	resources/assets/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
#	resources/assets/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js
#	resources/assets/js/plugins/chartjs/Chart.js
#	resources/assets/js/plugins/timepicker/bootstrap-timepicker.js
#	resources/assets/js/plugins/timepicker/bootstrap-timepicker.min.js
#	resources/assets/less/AdminLTE.less
#	resources/assets/less/overrides.less
#	resources/assets/less/skins/_all-skins.less
#	resources/assets/less/skins/skin-black.less
#	resources/assets/less/skins/skin-blue.less
#	resources/assets/less/skins/skin-green.less
#	resources/assets/less/skins/skin-purple.less
#	resources/assets/less/skins/skin-red.less
#	resources/assets/less/skins/skin-yellow.less
#	resources/assets/less/variables.less
#	resources/js/components/importer/importer-file.vue
#	resources/lang/en/auth/message.php
#	resources/lang/en/passwords.php
#	resources/lang/es-CO/general.php
#	resources/lang/es-ES/general.php
#	resources/lang/es-VE/general.php
#	resources/less/skins/skin-black-dark.less
#	resources/less/skins/skin-blue-dark.less
#	resources/less/skins/skin-contrast.less
#	resources/less/skins/skin-green-dark.less
#	resources/less/skins/skin-orange-dark.less
#	resources/less/skins/skin-orange.less
#	resources/less/skins/skin-purple-dark.less
#	resources/less/skins/skin-red-dark.less
#	resources/less/skins/skin-yellow-dark.less
#	resources/views/accessories/checkin.blade.php
#	resources/views/accessories/checkout.blade.php
#	resources/views/accessories/edit.blade.php
#	resources/views/account/profile.blade.php
#	resources/views/account/view-assets.blade.php
#	resources/views/asset_maintenances/edit.blade.php
#	resources/views/auth/passwords/email.blade.php
#	resources/views/auth/passwords/reset.blade.php
#	resources/views/categories/edit.blade.php
#	resources/views/companies/edit.blade.php
#	resources/views/components/checkin.blade.php
#	resources/views/components/checkout.blade.php
#	resources/views/components/edit.blade.php
#	resources/views/consumables/checkout.blade.php
#	resources/views/consumables/edit.blade.php
#	resources/views/custom_fields/fields/edit.blade.php
#	resources/views/custom_fields/fieldsets/edit.blade.php
#	resources/views/dashboard.blade.php
#	resources/views/departments/edit.blade.php
#	resources/views/groups/edit.blade.php
#	resources/views/hardware/audit.blade.php
#	resources/views/hardware/bulk-checkout.blade.php
#	resources/views/hardware/bulk.blade.php
#	resources/views/hardware/checkin.blade.php
#	resources/views/hardware/checkout.blade.php
#	resources/views/hardware/edit.blade.php
#	resources/views/hardware/index.blade.php
#	resources/views/hardware/quickscan.blade.php
#	resources/views/hardware/view.blade.php
#	resources/views/importer/import.blade.php
#	resources/views/layouts/basic.blade.php
#	resources/views/layouts/default.blade.php
#	resources/views/layouts/edit-form.blade.php
#	resources/views/licenses/checkin.blade.php
#	resources/views/licenses/checkout.blade.php
#	resources/views/licenses/edit.blade.php
#	resources/views/locations/edit.blade.php
#	resources/views/manufacturers/edit.blade.php
#	resources/views/modals/upload-file.blade.php
#	resources/views/models/bulk-edit.blade.php
#	resources/views/models/custom_fields_form.blade.php
#	resources/views/models/edit.blade.php
#	resources/views/partials/bootstrap-table.blade.php
#	resources/views/partials/forms/edit/address.blade.php
#	resources/views/partials/forms/edit/asset-select.blade.php
#	resources/views/partials/forms/edit/category-select.blade.php
#	resources/views/partials/forms/edit/category.blade.php
#	resources/views/partials/forms/edit/company-select.blade.php
#	resources/views/partials/forms/edit/company.blade.php
#	resources/views/partials/forms/edit/department-select.blade.php
#	resources/views/partials/forms/edit/depreciation.blade.php
#	resources/views/partials/forms/edit/email.blade.php
#	resources/views/partials/forms/edit/image-upload.blade.php
#	resources/views/partials/forms/edit/item_number.blade.php
#	resources/views/partials/forms/edit/location-profile-select.blade.php
#	resources/views/partials/forms/edit/location-select.blade.php
#	resources/views/partials/forms/edit/location.blade.php
#	resources/views/partials/forms/edit/maintenance_type.blade.php
#	resources/views/partials/forms/edit/manufacturer-select.blade.php
#	resources/views/partials/forms/edit/manufacturer.blade.php
#	resources/views/partials/forms/edit/minimum_quantity.blade.php
#	resources/views/partials/forms/edit/model-select.blade.php
#	resources/views/partials/forms/edit/model_number.blade.php
#	resources/views/partials/forms/edit/name.blade.php
#	resources/views/partials/forms/edit/notes.blade.php
#	resources/views/partials/forms/edit/order_number.blade.php
#	resources/views/partials/forms/edit/phone.blade.php
#	resources/views/partials/forms/edit/purchase_cost.blade.php
#	resources/views/partials/forms/edit/purchase_date.blade.php
#	resources/views/partials/forms/edit/quantity.blade.php
#	resources/views/partials/forms/edit/serial.blade.php
#	resources/views/partials/forms/edit/status.blade.php
#	resources/views/partials/forms/edit/submit.blade.php
#	resources/views/partials/forms/edit/supplier-select.blade.php
#	resources/views/partials/forms/edit/supplier.blade.php
#	resources/views/partials/forms/edit/user-select.blade.php
#	resources/views/reports/custom.blade.php
#	resources/views/settings/alerts.blade.php
#	resources/views/settings/asset_tags.blade.php
#	resources/views/settings/barcodes.blade.php
#	resources/views/settings/branding.blade.php
#	resources/views/settings/general.blade.php
#	resources/views/settings/labels.blade.php
#	resources/views/settings/ldap.blade.php
#	resources/views/settings/localization.blade.php
#	resources/views/settings/security.blade.php
#	resources/views/setup/user.blade.php
#	resources/views/suppliers/edit.blade.php
#	resources/views/users/bulk-edit.blade.php
#	resources/views/users/edit.blade.php
#	resources/views/users/ldap.blade.php
#	resources/views/users/print.blade.php
#	resources/views/users/view.blade.php
#	routes/api.php
#	routes/web/hardware.php
#	webpack.mix.js
2020-04-20 23:20:34 -07:00

982 lines
27 KiB
PHP

<?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!
|
*/
Route::group(['prefix' => 'v1','namespace' => 'Api', 'middleware' => 'auth:api'], function () {
Route::group(['prefix' => 'account'], function () {
Route::get('requestable/hardware',
[
'as' => 'api.assets.requestable',
'uses' => 'AssetsController@requestable'
]
);
Route::get('requests',
[
'as' => 'api.assets.requested',
'uses' => 'ProfileController@requestedAssets'
]
);
});
/*--- Accessories API ---*/
Route::group(['prefix' => 'accessories'], function () {
Route::get('{accessory}/checkedout',
[
'as' => 'api.accessories.checkedout',
'uses' => 'AccessoriesController@checkedout'
]
);
Route::get('selectlist',
[
'as' => 'api.accessories.selectlist',
'uses'=> 'AccessoriesController@selectlist'
]
);
});
// Accessories group
Route::resource('accessories', 'AccessoriesController',
['names' =>
[
'index' => 'api.accessories.index',
'show' => 'api.accessories.show',
'update' => 'api.accessories.update',
'store' => 'api.accessories.store',
'destroy' => 'api.accessories.destroy'
],
'except' => ['create', 'edit'],
'parameters' => ['accessory' => 'accessory_id']
]
);
// Accessories resource
Route::group(['prefix' => 'accessories'], function () {
Route::get('{accessory}/checkedout',
[
'as' => 'api.accessories.checkedout',
'uses' => 'AccessoriesController@checkedout'
]
);
Route::post('{accessory}/checkout',
[
'as' => 'api.accessories.checkout',
'uses' => 'AccessoriesController@checkout'
]
);
Route::post('{accessory}/checkin',
[
'as' => 'api.accessories.checkin',
'uses' => 'AccessoriesController@checkin'
]
);
}); // Accessories group
/*--- Categories API ---*/
Route::group(['prefix' => 'categories'], function () {
Route::get('{item_type}/selectlist',
[
'as' => 'api.categories.selectlist',
'uses' => 'CategoriesController@selectlist'
]
);
});
// Categories group
Route::resource('categories', 'CategoriesController',
[
'names' =>
[
'index' => 'api.categories.index',
'show' => 'api.categories.show',
'store' => 'api.categories.store',
'update' => 'api.categories.update',
'destroy' => 'api.categories.destroy'
],
'except' => ['edit', 'create'],
'parameters' => ['category' => 'category_id']
]
); // Categories resource
/*--- Companies API ---*/
Route::get( 'companies/selectlist', [
'as' => 'companies.selectlist',
'uses' => 'CompaniesController@selectlist'
]);
// Companies resource
Route::resource('companies', 'CompaniesController',
[
'names' =>
[
'index' => 'api.companies.index',
'show' => 'api.companies.show',
'store' => 'api.companies.store',
'update' => 'api.companies.update',
'destroy' => 'api.companies.destroy'
],
'except' => ['create', 'edit'],
'parameters' => ['component' => 'component_id']
]
); // Companies resource
/*--- Departments API ---*/
/*--- Suppliers API ---*/
Route::group(['prefix' => 'departments'], function () {
Route::get('selectlist',
[
'as' => 'api.departments.selectlist',
'uses' => 'DepartmentsController@selectlist'
]
);
}); // Departments group
Route::resource('departments', 'DepartmentsController',
[
'names' =>
[
'index' => 'api.departments.index',
'show' => 'api.departments.show',
'store' => 'api.departments.store',
'update' => 'api.departments.update',
'destroy' => 'api.departments.destroy'
],
'except' => ['create', 'edit'],
'parameters' => ['department' => 'department_id']
]
); // Departments resource
/*--- Components API ---*/
Route::resource('components', 'ComponentsController',
[
'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']
]
); // Components resource
Route::group(['prefix' => 'components'], function () {
Route::get('{component}/assets',
[
'as' =>'api.components.assets',
'uses' => 'ComponentsController@getAssets',
]
);
}); // Components group
/*--- Consumables API ---*/
Route::get('consumables/selectlist',
[
'as' => 'api.consumables.selectlist',
'uses'=> 'ConsumablesController@selectlist'
]
);
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']
]
); // Consumables resource
Route::get('consumables/view/{id}/users',
[
'as' => 'api.consumables.showUsers',
'uses' => 'ConsumablesController@getDataView'
]
);
/*--- Depreciations API ---*/
Route::resource('depreciations', 'DepreciationsController',
[
'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']
]
); // Depreciations resource
/*--- Fields API ---*/
Route::resource('fields', 'CustomFieldsController', [
'names' => [
'index' => 'api.customfields.index',
'show' => 'api.customfields.show',
'store' => 'api.customfields.store',
'update' => 'api.customfields.update',
'destroy' => 'api.customfields.destroy'
],
'except' => [ 'create', 'edit' ],
'parameters' => [ 'field' => 'field_id' ]
]);
Route::group(['prefix' => 'fields'], function () {
Route::post('fieldsets/{id}/order',
[
'as' => 'api.customfields.order',
'uses' => 'CustomFieldsController@postReorder'
]
);
Route::post('{field}/associate',
[
'as' => 'api.customfields.associate',
'uses' => 'CustomFieldsController@associate'
]
);
Route::post('{field}/disassociate',
[
'as' => 'api.customfields.disassociate',
'uses' => 'CustomFieldsController@disassociate'
]
);
}); // Fields group
/*--- Fieldsets API ---*/
Route::group(['prefix' => 'fieldsets'], function () {
Route::get('{fieldset}/fields',
[
'as' => 'api.fieldsets.fields',
'uses' => 'CustomFieldsetsController@fields'
]
);
Route::get('/{fieldset}/fields/{model}',
[
'as' => 'api.fieldsets.fields-with-default-value',
'uses' => 'CustomFieldsetsController@fieldsWithDefaultValues'
]
);
});
Route::resource('fieldsets', 'CustomFieldsetsController',
[
'names' =>
[
'index' => 'api.fieldsets.index',
'show' => 'api.fieldsets.show',
'store' => 'api.fieldsets.store',
'update' => 'api.fieldsets.update',
'destroy' => 'api.fieldsets.destroy'
],
'except' => ['create', 'edit'],
'parameters' => ['fieldset' => 'fieldset_id']
]
); // Custom fieldset resource
/*--- 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']
]
); // Groups resource
/*--- Hardware API ---*/
Route::group(['prefix' => 'hardware'], function () {
Route::get('{asset_id}/licenses', [
'as' => 'api.assets.licenselist',
'uses' => 'AssetsController@licenses'
]);
Route::get( 'bytag/{tag}', [
'as' => 'assets.show.bytag',
'uses' => 'AssetsController@showByTag'
]);
Route::get('bytag/{any}',
[
'as' => 'api.assets.show.bytag',
'uses' => 'AssetsController@showByTag'
]
)->where('any', '.*');
Route::get('byserial/{any}',
[
'as' => 'api.assets.show.byserial',
'uses' => 'AssetsController@showBySerial'
]
)->where('any', '.*');
Route::get( 'selectlist', [
'as' => 'assets.selectlist',
'uses' => 'AssetsController@selectlist'
]);
Route::get('audit/{audit}', [
'as' => 'api.asset.to-audit',
'uses' => 'AssetsController@index'
]);
Route::post('audit', [
'as' => 'api.asset.audit',
'uses' => 'AssetsController@audit'
]);
Route::post('{asset_id}/checkout',
[
'as' => 'api.assets.checkout',
'uses' => 'AssetsController@checkout'
]
);
Route::post('{asset_id}/checkin',
[
'as' => 'api.assets.checkin',
'uses' => 'AssetsController@checkin'
]
);
});
/*--- Asset Maintenances API ---*/
Route::resource('maintenances', 'AssetMaintenancesController',
[
'names' =>
[
'index' => 'api.maintenances.index',
'show' => 'api.maintenances.show',
'store' => 'api.maintenances.store',
'update' => 'api.maintenances.update',
'destroy' => 'api.maintenances.destroy'
],
'except' => ['create', 'edit'],
'parameters' => ['maintenance' => 'maintenance_id']
]
); // Consumables resource
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
/*--- Imports API ---*/
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
Route::group(['prefix' => 'imports'], function () {
Route::post('process/{import}',
[
'as' => 'api.imports.importFile',
'uses'=> 'ImportController@process'
]
);
}); // Imports group
/*--- Licenses API ---*/
Route::group(['prefix' => 'licenses'], function () {
Route::get('{licenseId}/seats', [
'as' => 'api.license.seats',
'uses' => 'LicensesController@seats'
]);
Route::get('selectlist',
[
'as' => 'api.licenses.selectlist',
'uses'=> 'LicensesController@selectlist'
]
);
}); // Licenses group
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
/*--- Locations API ---*/
Route::group(['prefix' => 'locations'], function () {
Route::get('{location}/users',
[
'as'=>'api.locations.viewusers',
'uses'=>'LocationsController@getDataViewUsers'
]
);
Route::get('{location}/assets',
[
'as'=>'api.locations.viewassets',
'uses'=>'LocationsController@getDataViewAssets'
]
);
// Do we actually still need this, now that we have an API?
Route::get('{location}/check',
[
'as' => 'api.locations.check',
'uses' => 'LocationsController@show'
]
);
Route::get( 'selectlist', [
'as' => 'locations.selectlist',
'uses' => 'LocationsController@selectlist'
]);
}); // Locations group
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']
]
); // Locations resource
/*--- Manufacturers API ---*/
Route::group(['prefix' => 'manufacturers'], function () {
Route::get( 'selectlist', [
'as' => 'manufacturers.selectlist',
'uses' => 'ManufacturersController@selectlist'
]);
}); // Locations group
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'],
'parameters' => ['manufacturer' => 'manufacturer_id']
]
); // Manufacturers resource
/*--- Models API ---*/
Route::group(['prefix' => 'models'], function () {
Route::get('assets',
[
'as' => 'api.models.assets',
'uses'=> 'AssetModelsController@assets'
]
);
Route::get('selectlist',
[
'as' => 'api.models.selectlist',
'uses'=> 'AssetModelsController@selectlist'
]
);
}); // Models group
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
/*--- Settings API ---*/
Route::get('settings/ldaptest', [
'as' => 'api.settings.ldaptest',
'uses' => 'SettingsController@ldapAdSettingsTest'
]);
Route::get('settings/login-attempts', [
'middleware' => ['auth', 'authorize:superuser'],
'as' => 'api.settings.login_attempts',
'uses' => 'SettingsController@showLoginAttempts'
]);
Route::post('settings/ldaptestlogin', [
'as' => 'api.settings.ldaptestlogin',
'uses' => 'SettingsController@ldaptestlogin'
]);
Route::post('settings/slacktest', [
'as' => 'api.settings.slacktest',
'uses' => 'SettingsController@slacktest'
]);
Route::post(
'settings/mailtest',
[
'as' => 'api.settings.mailtest',
'uses' => 'SettingsController@ajaxTestEmail'
]);
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']
]
); // Settings resource
/*--- Status Labels API ---*/
Route::group(['prefix' => 'statuslabels'], function () {
// Pie chart for dashboard
Route::get('assets',
[
'as' => 'api.statuslabels.assets.bytype',
'uses' => 'StatuslabelsController@getAssetCountByStatuslabel'
]
);
Route::get('{statuslabel}/assetlist',
[
'as' => 'api.statuslabels.assets',
'uses' => 'StatuslabelsController@assets'
]
);
Route::get('{statuslabel}/deployable',
[
'as' => 'api.statuslabels.deployable',
'uses' => 'StatuslabelsController@checkIfDeployable'
]
);
});
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
/*--- Suppliers API ---*/
Route::group(['prefix' => 'suppliers'], function () {
Route::get('list',
[
'as'=>'api.suppliers.list',
'uses'=>'SuppliersController@getDatatable'
]
);
Route::get('selectlist',
[
'as' => 'api.suppliers.selectlist',
'uses' => 'SuppliersController@selectlist'
]
);
}); // Suppliers group
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
/*--- Users API ---*/
Route::group([ 'prefix' => 'users' ], function () {
Route::post('two_factor_reset',
[
'as' => 'api.users.two_factor_reset',
'uses' => 'UsersController@postTwoFactorReset'
]
);
Route::get('me',
[
'as' => 'api.users.me',
'uses' => 'UsersController@getCurrentUserInfo'
]
);
Route::get('list/{status?}',
[
'as' => 'api.users.list',
'uses' => 'UsersController@getDatatable'
]
);
Route::get('selectlist',
[
'as' => 'api.users.selectlist',
'uses' => 'UsersController@selectList'
]
);
Route::get('{user}/assets',
[
'as' => 'api.users.assetlist',
'uses' => 'UsersController@assets'
]
);
Route::get('{user}/licenses',
[
'as' => 'api.users.licenselist',
'uses' => 'UsersController@licenses'
]
);
Route::get('{user}/licenses',
[
'as' => 'api.users.licenselist',
'uses' => 'UsersController@licenses'
]
);
Route::post('{user}/upload',
[
'as' => 'api.users.uploads',
'uses' => 'UsersController@postUpload'
]
);
}); // Users group
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
Route::get(
'reports/activity',
[ 'as' => 'api.activity.index', 'uses' => 'ReportsController@index' ]
);
/*--- Kits API ---*/
Route::resource('kits', 'PredefinedKitsController',
[
'names' =>
[
'index' => 'api.kits.index',
'show' => 'api.kits.show',
'store' => 'api.kits.store',
'update' => 'api.kits.update',
'destroy' => 'api.kits.destroy',
],
'except' => ['create', 'edit'],
'parameters' => ['kit' => 'kit_id']
]
);
Route::group([ 'prefix' => 'kits/{kit_id}' ], function () {
// kit licenses
Route::get('licenses',
[
'as' => 'api.kits.licenses.index',
'uses' => 'PredefinedKitsController@indexLicenses',
]
);
Route::post('licenses',
[
'as' => 'api.kits.licenses.store',
'uses' => 'PredefinedKitsController@storeLicense',
]
);
Route::put('licenses/{license_id}',
[
'as' => 'api.kits.licenses.update',
'uses' => 'PredefinedKitsController@updateLicense',
]
);
Route::delete('licenses/{license_id}',
[
'as' => 'api.kits.licenses.destroy',
'uses' => 'PredefinedKitsController@detachLicense',
]
);
// kit models
Route::get('models',
[
'as' => 'api.kits.models.index',
'uses' => 'PredefinedKitsController@indexModels',
]
);
Route::post('models',
[
'as' => 'api.kits.models.store',
'uses' => 'PredefinedKitsController@storeModel',
]
);
Route::put('models/{model_id}',
[
'as' => 'api.kits.models.update',
'uses' => 'PredefinedKitsController@updateModel',
]
);
Route::delete('models/{model_id}',
[
'as' => 'api.kits.models.destroy',
'uses' => 'PredefinedKitsController@detachModel',
]
);
// kit accessories
Route::get('accessories',
[
'as' => 'api.kits.accessories.index',
'uses' => 'PredefinedKitsController@indexAccessories',
]
);
Route::post('accessories',
[
'as' => 'api.kits.accessories.store',
'uses' => 'PredefinedKitsController@storeAccessory',
]
);
Route::put('accessories/{accessory_id}',
[
'as' => 'api.kits.accessories.update',
'uses' => 'PredefinedKitsController@updateAccessory',
]
);
Route::delete('accessories/{accessory_id}',
[
'as' => 'api.kits.accessories.destroy',
'uses' => 'PredefinedKitsController@detachAccessory',
]
);
// kit consumables
Route::get('consumables',
[
'as' => 'api.kits.consumables.index',
'uses' => 'PredefinedKitsController@indexConsumables',
]
);
Route::post('consumables',
[
'as' => 'api.kits.consumables.store',
'uses' => 'PredefinedKitsController@storeConsumable',
]
);
Route::put('consumables/{consumable_id}',
[
'as' => 'api.kits.consumables.update',
'uses' => 'PredefinedKitsController@updateConsumable',
]
);
Route::delete('consumables/{consumable_id}',
[
'as' => 'api.kits.consumables.destroy',
'uses' => 'PredefinedKitsController@detachConsumable',
]
);
}); // kits group
});