From e3e0d57f56799626c9be889b24cec7740e45d514 Mon Sep 17 00:00:00 2001 From: Martin Meredith Date: Thu, 14 Mar 2019 03:12:03 +0000 Subject: [PATCH] Minor code cleanup bits and bobs (#6805) * Add IDE Helper files * Cleanup imports - Alphabetises imports - Removes unused imports * Add Platform requirements * Move filling asset into block where asset exists * Remove duplicate array keys --- .gitignore | 2 + app/Console/Commands/DisableLDAP.php | 2 +- app/Console/Commands/LdapSync.php | 10 +- app/Console/Commands/ObjectImportCommand.php | 22 - app/Console/Commands/Purge.php | 27 +- app/Console/Commands/RecryptFromMcrypt.php | 6 +- app/Console/Commands/RegenerateAssetTags.php | 3 +- app/Console/Commands/ResetDemoSettings.php | 2 +- app/Console/Commands/RestoreDeletedUsers.php | 9 +- .../Commands/SendCurrentInventoryToUsers.php | 3 +- app/Console/Commands/SyncAssetCounters.php | 2 +- app/Console/Commands/SyncAssetLocations.php | 4 +- app/Events/CheckoutAccepted.php | 4 - app/Events/CheckoutDeclined.php | 4 - app/Exceptions/CheckoutNotAllowed.php | 1 + app/Exceptions/Handler.php | 3 +- app/Helpers/Helper.php | 20 +- .../Accessories/AccessoriesController.php | 3 +- .../AccessoryCheckinController.php | 1 - .../Account/AcceptanceController.php | 5 +- .../Controllers/Api/AccessoriesController.php | 9 +- .../Api/AssetMaintenancesController.php | 1 - .../Controllers/Api/AssetModelsController.php | 9 +- app/Http/Controllers/Api/AssetsController.php | 16 +- .../Controllers/Api/CategoriesController.php | 6 +- .../Controllers/Api/CompaniesController.php | 8 +- .../Controllers/Api/ComponentsController.php | 12 +- .../Controllers/Api/ConsumablesController.php | 8 +- .../Api/CustomFieldsController.php | 1 - .../Api/CustomFieldsetsController.php | 19 +- .../Controllers/Api/DepartmentsController.php | 10 +- .../Api/DepreciationsController.php | 6 +- app/Http/Controllers/Api/GroupsController.php | 6 +- app/Http/Controllers/Api/ImportController.php | 7 +- .../Controllers/Api/LicensesController.php | 2 +- .../Controllers/Api/LocationsController.php | 6 +- .../Api/ManufacturersController.php | 7 +- .../Api/PredefinedKitsController.php | 6 +- .../Controllers/Api/ProfileController.php | 7 +- .../Controllers/Api/ReportsController.php | 4 +- .../Controllers/Api/SettingsController.php | 18 +- .../Api/StatuslabelsController.php | 10 +- .../Controllers/Api/SuppliersController.php | 9 +- app/Http/Controllers/Api/UsersController.php | 20 +- .../AssetMaintenancesController.php | 19 +- .../Controllers/AssetModelsController.php | 7 +- .../Assets/AssetCheckoutController.php | 3 - .../Controllers/Assets/AssetsController.php | 13 +- .../Assets/BulkAssetsController.php | 1 - .../Auth/ForgotPasswordController.php | 1 - app/Http/Controllers/Auth/LoginController.php | 14 +- .../Controllers/Auth/RegisterController.php | 1 - .../Auth/ResetPasswordController.php | 1 - app/Http/Controllers/CategoriesController.php | 17 +- app/Http/Controllers/CheckInOutRequest.php | 1 - app/Http/Controllers/CompaniesController.php | 3 +- .../Components/ComponentCheckinController.php | 1 - .../Consumables/ConsumablesController.php | 1 - app/Http/Controllers/Controller.php | 6 +- .../Controllers/CustomFieldsController.php | 6 +- .../Controllers/CustomFieldsetsController.php | 8 +- app/Http/Controllers/DashboardController.php | 6 +- .../Controllers/DepartmentsController.php | 7 +- .../Controllers/DepreciationsController.php | 2 +- app/Http/Controllers/GroupsController.php | 4 +- app/Http/Controllers/ImportsController.php | 3 +- .../Kits/CheckoutKitController.php | 20 +- .../Kits/PredefinedKitsController.php | 11 +- .../Licenses/LicenseCheckinController.php | 3 +- .../Licenses/LicenseCheckoutController.php | 5 +- .../Licenses/LicenseFilesController.php | 4 +- .../Licenses/LicensesController.php | 10 +- app/Http/Controllers/LocationsController.php | 3 +- .../Controllers/ManufacturersController.php | 5 +- app/Http/Controllers/ModalController.php | 2 - app/Http/Controllers/ProfileController.php | 12 +- app/Http/Controllers/ReportsController.php | 4 +- app/Http/Controllers/SettingsController.php | 1 - .../Controllers/StatuslabelsController.php | 6 +- app/Http/Controllers/SuppliersController.php | 5 +- .../Users/LDAPImportController.php | 2 +- .../Controllers/Users/UserFilesController.php | 3 +- .../Controllers/Users/UsersController.php | 20 - app/Http/Controllers/ViewAssetsController.php | 4 +- app/Http/Middleware/CheckForDebug.php | 2 +- app/Http/Middleware/CheckForSetup.php | 6 +- app/Http/Middleware/CheckForTwoFactor.php | 2 +- app/Http/Middleware/CheckLocale.php | 3 +- app/Http/Middleware/CheckPermissions.php | 2 - app/Http/Requests/AssetCheckinRequest.php | 2 - app/Http/Requests/AssetCheckoutRequest.php | 2 - app/Http/Requests/AssetFileRequest.php | 2 - app/Http/Requests/ImageUploadRequest.php | 1 - app/Http/Requests/LicenseCheckoutRequest.php | 1 - app/Http/Requests/Request.php | 1 - app/Http/Requests/SaveUserRequest.php | 1 - app/Http/Requests/SettingsLdapRequest.php | 1 - app/Http/Requests/SetupUserRequest.php | 2 - .../Transformers/AccessoriesTransformer.php | 2 +- .../Transformers/ActionlogsTransformer.php | 3 +- .../AssetMaintenancesTransformer.php | 2 +- .../Transformers/AssetModelsTransformer.php | 6 +- app/Http/Transformers/AssetsTransformer.php | 7 +- .../Transformers/CategoriesTransformer.php | 6 +- .../Transformers/CompaniesTransformer.php | 6 +- .../ComponentsAssetsTransformer.php | 4 +- .../Transformers/ComponentsTransformer.php | 8 +- .../Transformers/ConsumablesTransformer.php | 4 +- .../Transformers/CustomFieldsTransformer.php | 3 +- .../CustomFieldsetsTransformer.php | 7 +- .../Transformers/DatatablesTransformer.php | 3 - .../Transformers/DepartmentsTranformer.php | 6 +- .../Transformers/DepreciationsTransformer.php | 6 +- app/Http/Transformers/GroupsTransformer.php | 6 +- app/Http/Transformers/ImportsTransformer.php | 1 - .../Transformers/LicenseSeatsTransformer.php | 3 +- app/Http/Transformers/LicensesTransformer.php | 2 +- .../Transformers/LocationsTransformer.php | 6 +- .../Transformers/LoginAttemptsTransformer.php | 2 - .../Transformers/ManufacturersTransformer.php | 6 +- .../PredefinedKitsTransformer.php | 4 +- .../Transformers/StatuslabelsTransformer.php | 6 +- .../Transformers/SuppliersTransformer.php | 6 +- app/Http/Transformers/UsersTransformer.php | 7 +- app/Importer/AccessoryImporter.php | 1 - app/Importer/AssetImporter.php | 3 - app/Importer/ConsumableImporter.php | 1 - app/Importer/Importer.php | 3 +- app/Importer/ItemImporter.php | 2 - app/Importer/LicenseImporter.php | 3 - app/Importer/UserImporter.php | 1 - app/LegacyEncrypter/McryptEncrypter.php | 4 +- app/Listeners/LogFailedLogin.php | 5 +- app/Listeners/LogListener.php | 9 +- app/Listeners/LogSuccessfulLogin.php | 5 +- app/Models/Accessory.php | 4 +- app/Models/Actionlog.php | 4 +- app/Models/Asset.php | 11 +- app/Models/AssetMaintenance.php | 2 - app/Models/AssetModel.php | 5 +- app/Models/Category.php | 2 - app/Models/CheckoutAcceptance.php | 1 - app/Models/CheckoutRequest.php | 3 +- app/Models/Company.php | 2 - app/Models/CompanyableChildScope.php | 4 +- app/Models/CompanyableScope.php | 4 +- app/Models/Consumable.php | 3 +- app/Models/CustomField.php | 8 +- app/Models/CustomFieldset.php | 2 +- app/Models/Department.php | 5 - app/Models/Depreciable.php | 4 - app/Models/Group.php | 1 - app/Models/License.php | 4 - app/Models/LicenseSeat.php | 2 - app/Models/Location.php | 5 - app/Models/Loggable.php | 5 - app/Models/PredefinedKit.php | 6 +- app/Models/Requestable.php | 2 - app/Models/Setting.php | 8 +- app/Models/SnipeModel.php | 1 - app/Models/Statuslabel.php | 2 - app/Models/Supplier.php | 2 - app/Models/Traits/Acceptable.php | 3 - app/Models/User.php | 18 +- app/Notifications/AuditNotification.php | 1 - .../CheckinAccessoryNotification.php | 3 - .../CheckinAssetNotification.php | 1 - .../CheckinLicenseSeatNotification.php | 4 - .../CheckoutAccessoryNotification.php | 3 - .../CheckoutAssetNotification.php | 1 - .../CheckoutConsumableNotification.php | 3 - .../CheckoutLicenseSeatNotification.php | 4 - app/Notifications/CurrentInventory.php | 3 +- .../ExpectedCheckinAdminNotification.php | 5 - .../ExpectedCheckinNotification.php | 6 +- .../ExpiringLicenseNotification.php | 1 - app/Notifications/FirstAdminNotification.php | 3 +- app/Notifications/InventoryAlert.php | 2 +- app/Notifications/MailTest.php | 3 +- app/Notifications/SlackTest.php | 6 +- app/Notifications/WelcomeNotification.php | 3 +- app/Observers/AccessoryObserver.php | 1 - app/Observers/AssetObserver.php | 2 +- app/Observers/ComponentObserver.php | 3 +- app/Observers/ConsumableObserver.php | 3 +- app/Observers/LicenseObserver.php | 3 +- app/Policies/AccessoryPolicy.php | 2 - app/Policies/AssetModelPolicy.php | 2 - app/Policies/AssetPolicy.php | 1 - app/Policies/CategoryPolicy.php | 2 - .../CheckoutablePermissionsPolicy.php | 1 - app/Policies/CompanyPolicy.php | 2 - app/Policies/ComponentPolicy.php | 2 - app/Policies/ConsumablePolicy.php | 2 - app/Policies/CustomFieldPolicy.php | 2 - app/Policies/CustomFieldsetPolicy.php | 2 - app/Policies/DepartmentPolicy.php | 2 - app/Policies/DepreciationPolicy.php | 2 - app/Policies/LicensePolicy.php | 1 - app/Policies/LocationPolicy.php | 2 - app/Policies/ManufacturerPolicy.php | 2 - app/Policies/StatuslabelPolicy.php | 2 - app/Policies/SupplierPolicy.php | 2 - app/Policies/UserPolicy.php | 2 - app/Presenters/AccessoryPresenter.php | 3 - app/Presenters/AssetMaintenancesPresenter.php | 2 - app/Presenters/AssetModelPresenter.php | 2 - app/Presenters/CategoryPresenter.php | 2 - app/Presenters/ComponentPresenter.php | 2 - app/Presenters/DepreciationPresenter.php | 2 - app/Presenters/LicensePresenter.php | 3 - app/Presenters/LicenseSeatPresenter.php | 3 - app/Presenters/LocationPresenter.php | 2 - app/Presenters/ManufacturerPresenter.php | 2 - app/Presenters/PredefinedKitPresenter.php | 3 - app/Presenters/UserPresenter.php | 4 - app/Providers/AppServiceProvider.php | 26 +- app/Providers/AuthServiceProvider.php | 10 +- app/Providers/RouteServiceProvider.php | 2 +- app/Providers/SettingsServiceProvider.php | 5 - app/Providers/ValidationServiceProvider.php | 17 +- app/Services/LdapAd.php | 11 +- app/Services/PredefinedKitCheckoutService.php | 6 +- composer.json | 9 + composer.lock | 647 +++++++++++++++++- 225 files changed, 991 insertions(+), 764 deletions(-) diff --git a/.gitignore b/.gitignore index c310b79d57..92b208b055 100755 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ tests/_support/_generated/* phpmd\.xml /public/storage +_ide_helper.php +.phpstorm.meta.php diff --git a/app/Console/Commands/DisableLDAP.php b/app/Console/Commands/DisableLDAP.php index 5522df37cc..fd2f0a1070 100644 --- a/app/Console/Commands/DisableLDAP.php +++ b/app/Console/Commands/DisableLDAP.php @@ -2,8 +2,8 @@ namespace App\Console\Commands; -use Illuminate\Console\Command; use App\Models\Setting; +use Illuminate\Console\Command; class DisableLDAP extends Command { diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index c8a0fecd65..effab2250b 100755 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -4,12 +4,12 @@ declare(strict_types=1); namespace App\Console\Commands; -use App\Services\LdapAd; -use Illuminate\Support\Facades\Log; -use Exception; -use App\Models\Location; -use Illuminate\Console\Command; use Adldap\Models\User as AdldapUser; +use App\Models\Location; +use App\Services\LdapAd; +use Exception; +use Illuminate\Console\Command; +use Illuminate\Support\Facades\Log; /** * LDAP / AD sync command. diff --git a/app/Console/Commands/ObjectImportCommand.php b/app/Console/Commands/ObjectImportCommand.php index 9f09ea7184..83d88ffb27 100644 --- a/app/Console/Commands/ObjectImportCommand.php +++ b/app/Console/Commands/ObjectImportCommand.php @@ -1,31 +1,9 @@ authorize('update', Asset::class); - $asset->fill($request->all()); - - if ($asset = Asset::find($id)) { + $asset->fill($request->all()); + ($request->filled('model_id')) ? $asset->model()->associate(AssetModel::find($request->get('model_id'))) : null; ($request->filled('rtd_location_id')) ? diff --git a/app/Http/Controllers/Api/CategoriesController.php b/app/Http/Controllers/Api/CategoriesController.php index a51376ac29..1b1304062b 100644 --- a/app/Http/Controllers/Api/CategoriesController.php +++ b/app/Http/Controllers/Api/CategoriesController.php @@ -2,12 +2,12 @@ namespace App\Http\Controllers\Api; -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use App\Helpers\Helper; -use App\Models\Category; +use App\Http\Controllers\Controller; use App\Http\Transformers\CategoriesTransformer; use App\Http\Transformers\SelectlistTransformer; +use App\Models\Category; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; class CategoriesController extends Controller diff --git a/app/Http/Controllers/Api/CompaniesController.php b/app/Http/Controllers/Api/CompaniesController.php index 56be71aaef..17f26aae61 100644 --- a/app/Http/Controllers/Api/CompaniesController.php +++ b/app/Http/Controllers/Api/CompaniesController.php @@ -2,12 +2,12 @@ namespace App\Http\Controllers\Api; -use App\Http\Transformers\CompaniesTransformer; -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use App\Helpers\Helper; -use App\Models\Company; +use App\Http\Controllers\Controller; +use App\Http\Transformers\CompaniesTransformer; use App\Http\Transformers\SelectlistTransformer; +use App\Models\Company; +use Illuminate\Http\Request; class CompaniesController extends Controller { diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.php index e077a6ea48..6d2788c084 100644 --- a/app/Http/Controllers/Api/ComponentsController.php +++ b/app/Http/Controllers/Api/ComponentsController.php @@ -2,14 +2,12 @@ namespace App\Http\Controllers\Api; -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; -use App\Http\Transformers\AssetsTransformer; -use App\Http\Transformers\ComponentsTransformer; -use App\Http\Transformers\ComponentsAssetsTransformer; -use App\Models\Component; -use App\Models\Company; use App\Helpers\Helper; +use App\Http\Controllers\Controller; +use App\Http\Transformers\ComponentsTransformer; +use App\Models\Company; +use App\Models\Component; +use Illuminate\Http\Request; class ComponentsController extends Controller { diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index f5dc8c8dee..46f36c58ba 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -2,13 +2,13 @@ namespace App\Http\Controllers\Api; -use Illuminate\Http\Request; +use App\Helpers\Helper; use App\Http\Controllers\Controller; +use App\Http\Transformers\ConsumablesTransformer; +use App\Http\Transformers\SelectlistTransformer; use App\Models\Company; use App\Models\Consumable; -use App\Http\Transformers\ConsumablesTransformer; -use App\Helpers\Helper; -use App\Http\Transformers\SelectlistTransformer; +use Illuminate\Http\Request; class ConsumablesController extends Controller { diff --git a/app/Http/Controllers/Api/CustomFieldsController.php b/app/Http/Controllers/Api/CustomFieldsController.php index cd93a46383..c425347c58 100644 --- a/app/Http/Controllers/Api/CustomFieldsController.php +++ b/app/Http/Controllers/Api/CustomFieldsController.php @@ -9,7 +9,6 @@ use App\Models\CustomField; use App\Models\CustomFieldset; use Illuminate\Http\Request; use Validator; -use Illuminate\Validation\Rule; class CustomFieldsController extends Controller { diff --git a/app/Http/Controllers/Api/CustomFieldsetsController.php b/app/Http/Controllers/Api/CustomFieldsetsController.php index 5ed9161522..08533229ee 100644 --- a/app/Http/Controllers/Api/CustomFieldsetsController.php +++ b/app/Http/Controllers/Api/CustomFieldsetsController.php @@ -1,21 +1,14 @@ ] diff --git a/app/Http/Controllers/Api/ProfileController.php b/app/Http/Controllers/Api/ProfileController.php index 0798381884..f6c31d5db1 100644 --- a/app/Http/Controllers/Api/ProfileController.php +++ b/app/Http/Controllers/Api/ProfileController.php @@ -2,11 +2,10 @@ namespace App\Http\Controllers\Api; -use App\Models\CheckoutRequest; -use App\Http\Controllers\Controller; -use Auth; use App\Helpers\Helper; - +use App\Http\Controllers\Controller; +use App\Models\CheckoutRequest; +use Auth; class ProfileController extends Controller { diff --git a/app/Http/Controllers/Api/ReportsController.php b/app/Http/Controllers/Api/ReportsController.php index e1b6ddd813..b29c327345 100644 --- a/app/Http/Controllers/Api/ReportsController.php +++ b/app/Http/Controllers/Api/ReportsController.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers\Api; -use Illuminate\Http\Request; use App\Http\Controllers\Controller; -use App\Models\Actionlog; use App\Http\Transformers\ActionlogsTransformer; +use App\Models\Actionlog; +use Illuminate\Http\Request; class ReportsController extends Controller { diff --git a/app/Http/Controllers/Api/SettingsController.php b/app/Http/Controllers/Api/SettingsController.php index b08cb06412..e008c3a877 100644 --- a/app/Http/Controllers/Api/SettingsController.php +++ b/app/Http/Controllers/Api/SettingsController.php @@ -2,17 +2,17 @@ namespace App\Http\Controllers\Api; -use App\Services\LdapAd; -use Illuminate\Support\Facades\DB; -use Illuminate\Support\Facades\Notification; -use App\Models\Setting; -use Illuminate\Http\Request; -use App\Notifications\MailTest; -use App\Notifications\SlackTest; -use Illuminate\Http\JsonResponse; -use Illuminate\Support\Facades\Log; use App\Http\Controllers\Controller; use App\Http\Transformers\LoginAttemptsTransformer; +use App\Models\Setting; +use App\Notifications\MailTest; +use App\Notifications\SlackTest; +use App\Services\LdapAd; +use Illuminate\Http\JsonResponse; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Notification; class SettingsController extends Controller { diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.php index 7304f7dcf3..4cd83a385b 100644 --- a/app/Http/Controllers/Api/StatuslabelsController.php +++ b/app/Http/Controllers/Api/StatuslabelsController.php @@ -2,13 +2,13 @@ namespace App\Http\Controllers\Api; -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use App\Helpers\Helper; -use App\Models\Statuslabel; -use App\Models\Asset; -use App\Http\Transformers\StatuslabelsTransformer; +use App\Http\Controllers\Controller; use App\Http\Transformers\AssetsTransformer; +use App\Http\Transformers\StatuslabelsTransformer; +use App\Models\Asset; +use App\Models\Statuslabel; +use Illuminate\Http\Request; class StatuslabelsController extends Controller { diff --git a/app/Http/Controllers/Api/SuppliersController.php b/app/Http/Controllers/Api/SuppliersController.php index d537f2d526..17b2b36beb 100644 --- a/app/Http/Controllers/Api/SuppliersController.php +++ b/app/Http/Controllers/Api/SuppliersController.php @@ -2,15 +2,14 @@ namespace App\Http\Controllers\Api; -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; use App\Helpers\Helper; -use App\Models\Supplier; -use App\Http\Transformers\SuppliersTransformer; +use App\Http\Controllers\Controller; use App\Http\Transformers\SelectlistTransformer; +use App\Http\Transformers\SuppliersTransformer; +use App\Models\Supplier; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; - class SuppliersController extends Controller { /** diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index c26d676949..ec1ae80ed9 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -2,19 +2,19 @@ namespace App\Http\Controllers\Api; -use App\Http\Transformers\LicensesTransformer; -use App\Models\License; -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; -use App\Http\Transformers\UsersTransformer; -use App\Models\Company; -use App\Models\User; use App\Helpers\Helper; +use App\Http\Controllers\Controller; use App\Http\Requests\SaveUserRequest; -use App\Models\Asset; -use App\Http\Transformers\AssetsTransformer; -use App\Http\Transformers\SelectlistTransformer; use App\Http\Transformers\AccessoriesTransformer; +use App\Http\Transformers\AssetsTransformer; +use App\Http\Transformers\LicensesTransformer; +use App\Http\Transformers\SelectlistTransformer; +use App\Http\Transformers\UsersTransformer; +use App\Models\Asset; +use App\Models\Company; +use App\Models\License; +use App\Models\User; +use Illuminate\Http\Request; class UsersController extends Controller { diff --git a/app/Http/Controllers/AssetMaintenancesController.php b/app/Http/Controllers/AssetMaintenancesController.php index 6e0100065a..b3f8482f1b 100644 --- a/app/Http/Controllers/AssetMaintenancesController.php +++ b/app/Http/Controllers/AssetMaintenancesController.php @@ -1,26 +1,17 @@ (int) $component->category->id, 'name' => e($component->category->name) ] : null, - 'location' => ($component->location) ? [ - 'id' => (int) $component->location->id, - 'name' => e($component->location->name) - ] : null, 'order_number' => e($component->order_number), 'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'), 'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost), diff --git a/app/Http/Transformers/ConsumablesTransformer.php b/app/Http/Transformers/ConsumablesTransformer.php index 36ec8d9c24..9d51c5e5c4 100644 --- a/app/Http/Transformers/ConsumablesTransformer.php +++ b/app/Http/Transformers/ConsumablesTransformer.php @@ -1,10 +1,10 @@ trans('admin/asset_maintenances/general.upgrade'), 'PAT test' => 'PAT test', trans('admin/asset_maintenances/general.calibration') => trans('admin/asset_maintenances/general.calibration'), - 'PAT test' => 'PAT test', ]; } diff --git a/app/Models/AssetModel.php b/app/Models/AssetModel.php index e2d58fa40d..f32ac0d414 100755 --- a/app/Models/AssetModel.php +++ b/app/Models/AssetModel.php @@ -1,14 +1,11 @@ requests diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 11325f0e8a..437938423f 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -2,13 +2,13 @@ namespace App\Models; -use Parsedown; -use Illuminate\Support\Facades\App; -use Illuminate\Support\Facades\Cache; use Illuminate\Database\Eloquent\Model; use Illuminate\Notifications\Notifiable; -use Watson\Validating\ValidatingTrait; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\Cache; +use Parsedown; +use Watson\Validating\ValidatingTrait; /** * Settings model. diff --git a/app/Models/SnipeModel.php b/app/Models/SnipeModel.php index f5505a74a8..2911be1c38 100644 --- a/app/Models/SnipeModel.php +++ b/app/Models/SnipeModel.php @@ -3,7 +3,6 @@ namespace App\Models; use App\Helpers\Helper; -use Carbon\Carbon; use Illuminate\Database\Eloquent\Model; class SnipeModel extends Model diff --git a/app/Models/Statuslabel.php b/app/Models/Statuslabel.php index c97b6c9c70..cd4672b841 100755 --- a/app/Models/Statuslabel.php +++ b/app/Models/Statuslabel.php @@ -2,9 +2,7 @@ namespace App\Models; use App\Http\Traits\UniqueUndeletedTrait; -use App\Models\SnipeModel; use App\Models\Traits\Searchable; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index 2313e998a9..230a713cda 100755 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -2,9 +2,7 @@ namespace App\Models; use App\Http\Traits\UniqueUndeletedTrait; -use App\Models\SnipeModel; use App\Models\Traits\Searchable; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; diff --git a/app/Models/Traits/Acceptable.php b/app/Models/Traits/Acceptable.php index a0c93a861b..4da3575182 100644 --- a/app/Models/Traits/Acceptable.php +++ b/app/Models/Traits/Acceptable.php @@ -2,10 +2,7 @@ namespace App\Models\Traits; -use App\Models\Asset; -use App\Models\CustomField; use App\Models\User; -use Illuminate\Database\Eloquent\Builder; /** * This trait allows models to have a callback after their checkout gets accepted or declined. diff --git a/app/Models/User.php b/app/Models/User.php index 7684e14607..36d57cfd08 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -1,24 +1,22 @@ =7.1.3", + "ext-curl": "*", + "ext-fileinfo": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-pdo": "*", "adldap2/adldap2": "^9.1", "bacon/bacon-qr-code": "^1.0", "doctrine/cache": "^1.6", @@ -45,6 +50,7 @@ }, "require-dev": { "barryvdh/laravel-debugbar": "^3.2", + "barryvdh/laravel-ide-helper": "^2.6", "codeception/codeception": "^2.4", "filp/whoops": "~2.0", "fzaninotto/faker": "~1.4", @@ -53,6 +59,9 @@ "symfony/css-selector": "4.0.*", "symfony/dom-crawler": "4.0.*" }, + "suggest": { + "ext-mcrypt": "For upgrading from before v5.1 this is used to re-encrypt data" + }, "extra": { "laravel": { "dont-discover": [ diff --git a/composer.lock b/composer.lock index caf0ea961d..010224354e 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3b6a6bea98c5876c05f1130cf7ad7e97", + "content-hash": "84e2cfa0d9406a810bd3ce6e0c2f3ffd", "packages": [ { "name": "adldap2/adldap2", @@ -6995,6 +6995,129 @@ ], "time": "2018-11-09T08:37:55+00:00" }, + { + "name": "barryvdh/laravel-ide-helper", + "version": "v2.6.1", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-ide-helper.git", + "reference": "725711022be71c6fa2e7bc8f9648bf125986f027" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/725711022be71c6fa2e7bc8f9648bf125986f027", + "reference": "725711022be71c6fa2e7bc8f9648bf125986f027", + "shasum": "" + }, + "require": { + "barryvdh/reflection-docblock": "^2.0.6", + "composer/composer": "^1.6", + "illuminate/console": "^5.5,<5.9", + "illuminate/filesystem": "^5.5,<5.9", + "illuminate/support": "^5.5,<5.9", + "php": ">=7" + }, + "require-dev": { + "doctrine/dbal": "~2.3", + "illuminate/config": "^5.1,<5.9", + "illuminate/view": "^5.1,<5.9", + "phpro/grumphp": "^0.14", + "phpunit/phpunit": "4.*", + "scrutinizer/ocular": "~1.1", + "squizlabs/php_codesniffer": "^3" + }, + "suggest": { + "doctrine/dbal": "Load information from the database about models for phpdocs (~2.3)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + }, + "laravel": { + "providers": [ + "Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Barryvdh\\LaravelIdeHelper\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.", + "keywords": [ + "autocomplete", + "codeintel", + "helper", + "ide", + "laravel", + "netbeans", + "phpdoc", + "phpstorm", + "sublime" + ], + "time": "2019-03-05T09:24:51+00:00" + }, + { + "name": "barryvdh/reflection-docblock", + "version": "v2.0.6", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/ReflectionDocBlock.git", + "reference": "6b69015d83d3daf9004a71a89f26e27d27ef6a16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/ReflectionDocBlock/zipball/6b69015d83d3daf9004a71a89f26e27d27ef6a16", + "reference": "6b69015d83d3daf9004a71a89f26e27d27ef6a16", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0,<4.5" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Barryvdh": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2018-12-13T10:34:14+00:00" + }, { "name": "behat/gherkin", "version": "v4.5.1", @@ -7219,6 +7342,309 @@ "description": "Flexible Stub wrapper for PHPUnit's Mock Builder", "time": "2018-07-26T11:55:37+00:00" }, + { + "name": "composer/ca-bundle", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/558f321c52faeb4828c03e7dc0cfe39a09e09a2d", + "reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "time": "2019-01-28T09:30:10+00:00" + }, + { + "name": "composer/composer", + "version": "1.8.4", + "source": { + "type": "git", + "url": "https://github.com/composer/composer.git", + "reference": "bc364c2480c17941e2135cfc568fa41794392534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/composer/zipball/bc364c2480c17941e2135cfc568fa41794392534", + "reference": "bc364c2480c17941e2135cfc568fa41794392534", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "composer/semver": "^1.0", + "composer/spdx-licenses": "^1.2", + "composer/xdebug-handler": "^1.1", + "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0", + "seld/jsonlint": "^1.4", + "seld/phar-utils": "^1.0", + "symfony/console": "^2.7 || ^3.0 || ^4.0", + "symfony/filesystem": "^2.7 || ^3.0 || ^4.0", + "symfony/finder": "^2.7 || ^3.0 || ^4.0", + "symfony/process": "^2.7 || ^3.0 || ^4.0" + }, + "conflict": { + "symfony/console": "2.8.38" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7", + "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" + }, + "suggest": { + "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", + "ext-zip": "Enabling the zip extension allows you to unzip archives", + "ext-zlib": "Allow gzip compression of HTTP requests" + }, + "bin": [ + "bin/composer" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\": "src/Composer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "time": "2019-02-11T09:52:10+00:00" + }, + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "composer/spdx-licenses", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "7a9556b22bd9d4df7cad89876b00af58ef20d3a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7a9556b22bd9d4df7cad89876b00af58ef20d3a2", + "reference": "7a9556b22bd9d4df7cad89876b00af58ef20d3a2", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "time": "2018-11-01T09:45:54+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "d17708133b6c276d6e42ef887a877866b909d892" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/d17708133b6c276d6e42ef887a877866b909d892", + "reference": "d17708133b6c276d6e42ef887a877866b909d892", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "time": "2019-01-28T20:25:53+00:00" + }, { "name": "facebook/webdriver", "version": "1.6.0", @@ -7390,6 +7816,72 @@ ], "time": "2018-07-12T10:23:15+00:00" }, + { + "name": "justinrainbow/json-schema", + "version": "5.2.8", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", + "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.2.20", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2019-01-14T23:55:14+00:00" + }, { "name": "maximebf/debugbar", "version": "v1.15.0", @@ -7984,6 +8476,7 @@ "mock", "xunit" ], + "abandoned": true, "time": "2018-05-29T13:54:20+00:00" }, { @@ -8510,6 +9003,99 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, + { + "name": "seld/jsonlint", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "time": "2018-01-24T12:46:19+00:00" + }, + { + "name": "seld/phar-utils", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\PharUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "PHAR file format utilities, for when PHP phars you up", + "keywords": [ + "phra" + ], + "time": "2015-10-13T18:44:15+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.3.2", @@ -8675,6 +9261,56 @@ "homepage": "https://symfony.com", "time": "2018-07-26T11:00:39+00:00" }, + { + "name": "symfony/filesystem", + "version": "v4.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e16b9e471703b2c60b95f14d31c1239f68f11601", + "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2019-02-07T11:40:08+00:00" + }, { "name": "symfony/yaml", "version": "v4.2.1", @@ -8783,7 +9419,12 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.1.3" + "php": ">=7.1.3", + "ext-curl": "*", + "ext-fileinfo": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-pdo": "*" }, "platform-dev": [], "platform-overrides": {