From b62d1f49e430214ebbefd34e5f4bdbe1a14952f2 Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Thu, 10 Jun 2021 20:19:27 +0000 Subject: [PATCH] Shift cleanup --- app/Console/Commands/ObjectImportCommand.php | 1 - app/Http/Requests/ItemImportRequest.php | 1 - app/Importer/ConsumableImporter.php | 1 - app/Importer/UserImporter.php | 1 - app/Models/Accessory.php | 3 +- app/Models/Actionlog.php | 3 +- app/Models/Asset.php | 5 ++- app/Models/AssetMaintenance.php | 3 +- app/Models/AssetModel.php | 3 +- app/Models/Category.php | 2 +- app/Models/Company.php | 2 +- app/Models/Component.php | 2 +- app/Models/Consumable.php | 3 +- app/Models/CustomField.php | 3 +- app/Models/CustomFieldset.php | 3 +- app/Models/Department.php | 2 +- app/Models/Depreciation.php | 2 +- app/Models/Group.php | 2 +- app/Models/License.php | 3 +- app/Models/Location.php | 6 ++-- app/Models/Manufacturer.php | 2 +- app/Models/Setting.php | 1 - app/Models/SnipeModel.php | 17 ---------- app/Models/Statuslabel.php | 3 +- app/Models/Supplier.php | 3 +- app/Models/User.php | 6 ++-- app/Providers/RouteServiceProvider.php | 6 ++-- database/factories/AccessoryFactory.php | 5 +-- database/factories/ActionlogFactory.php | 3 +- database/factories/AssetFactory.php | 23 +------------- .../factories/AssetMaintenanceFactory.php | 2 +- database/factories/AssetModelFactory.php | 14 ++------- database/factories/CategoryFactory.php | 5 +-- database/factories/CompanyFactory.php | 2 +- database/factories/ComponentFactory.php | 5 +-- database/factories/ConsumableFactory.php | 5 +-- database/factories/CustomFieldFactory.php | 2 ++ database/factories/CustomFieldsetFactory.php | 2 ++ database/factories/DepartmentFactory.php | 5 +-- database/factories/DepreciationFactory.php | 5 +-- database/factories/GroupFactory.php | 2 +- database/factories/LicenseFactory.php | 6 ++-- database/factories/LocationFactory.php | 2 +- database/factories/ManufacturerFactory.php | 6 ++-- database/factories/SettingFactory.php | 2 +- database/factories/StatuslabelFactory.php | 2 +- database/factories/SupplierFactory.php | 2 +- database/factories/UserFactory.php | 31 +------------------ database/seeders/AccessorySeeder.php | 11 ++++--- database/seeders/AssetModelSeeder.php | 9 +++--- database/seeders/AssetSeeder.php | 6 ++-- database/seeders/CompanySeeder.php | 12 ++++--- database/seeders/ComponentSeeder.php | 1 + database/seeders/ConsumableSeeder.php | 1 + database/seeders/CustomFieldSeeder.php | 1 + database/seeders/DatabaseSeeder.php | 23 ++++++++------ database/seeders/LocationSeeder.php | 9 +++--- database/seeders/ManufacturerSeeder.php | 9 +++--- database/seeders/SettingsSeeder.php | 1 + routes/api.php | 3 +- routes/web.php | 12 +++---- routes/web/fields.php | 1 + routes/web/hardware.php | 1 + tests/_support/FunctionalTester.php | 2 +- 64 files changed, 128 insertions(+), 194 deletions(-) diff --git a/app/Console/Commands/ObjectImportCommand.php b/app/Console/Commands/ObjectImportCommand.php index 089ba34637..c89018400a 100644 --- a/app/Console/Commands/ObjectImportCommand.php +++ b/app/Console/Commands/ObjectImportCommand.php @@ -74,7 +74,6 @@ class ObjectImportCommand extends Command $this->comment('All Items imported successfully!'); } $this->comment(''); - } public function errorCallback($item, $field, $errorString) diff --git a/app/Http/Requests/ItemImportRequest.php b/app/Http/Requests/ItemImportRequest.php index 05babb97cd..fbf36bf65f 100644 --- a/app/Http/Requests/ItemImportRequest.php +++ b/app/Http/Requests/ItemImportRequest.php @@ -80,7 +80,6 @@ class ItemImportRequest extends FormRequest public function progress($count) { // Open for future - } public function errorCallback($item, $field, $errorString) diff --git a/app/Importer/ConsumableImporter.php b/app/Importer/ConsumableImporter.php index 2fbed94dea..cc24daa930 100644 --- a/app/Importer/ConsumableImporter.php +++ b/app/Importer/ConsumableImporter.php @@ -53,6 +53,5 @@ class ConsumableImporter extends ItemImporter return; } $this->logError($consumable, 'Consumable'); - } } diff --git a/app/Importer/UserImporter.php b/app/Importer/UserImporter.php index 37434f1616..14614c02a7 100644 --- a/app/Importer/UserImporter.php +++ b/app/Importer/UserImporter.php @@ -106,7 +106,6 @@ class UserImporter extends ItemImporter } $this->logError($user, 'User'); - } /** diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php index c3679ae571..09b2e11a17 100755 --- a/app/Models/Accessory.php +++ b/app/Models/Accessory.php @@ -2,10 +2,10 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Acceptable; use App\Models\Traits\Searchable; use App\Presenters\Presentable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Storage; use Watson\Validating\ValidatingTrait; @@ -120,7 +120,6 @@ class Accessory extends SnipeModel $value = null; } $this->attributes['requestable'] = filter_var($value, FILTER_VALIDATE_BOOLEAN); - } /** diff --git a/app/Models/Actionlog.php b/app/Models/Actionlog.php index d94725dfb2..edbc9d9eef 100755 --- a/app/Models/Actionlog.php +++ b/app/Models/Actionlog.php @@ -2,10 +2,10 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Searchable; use App\Presenters\Presentable; use Carbon; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Auth; @@ -23,7 +23,6 @@ class Actionlog extends SnipeModel use SoftDeletes; use Presentable; - protected $table = 'action_logs'; public $timestamps = true; protected $fillable = ['created_at', 'item_type', 'user_id', 'item_id', 'action_type', 'note', 'target_id', 'target_type']; diff --git a/app/Models/Asset.php b/app/Models/Asset.php index f83b2e14f9..b16d2d38c4 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -2,7 +2,6 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Events\AssetCheckedOut; use App\Events\CheckoutableCheckedOut; use App\Exceptions\CheckoutNotAllowed; @@ -16,6 +15,7 @@ use Auth; use Carbon\Carbon; use DB; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Storage; use Watson\Validating\ValidatingTrait; @@ -70,7 +70,6 @@ class Asset extends Depreciable // We set these as protected dates so that they will be easily accessible via Carbon - protected $casts = [ 'purchase_date' => 'datetime', 'last_checkout' => 'datetime', @@ -442,7 +441,7 @@ class Asset extends Depreciable */ public function assignedAssets() { - return $this->morphMany(\App\Models\Asset::class, 'assigned', 'assigned_type', 'assigned_to')->withTrashed(); + return $this->morphMany(self::class, 'assigned', 'assigned_type', 'assigned_to')->withTrashed(); } /** diff --git a/app/Models/AssetMaintenance.php b/app/Models/AssetMaintenance.php index bee38abb61..27273eefc4 100644 --- a/app/Models/AssetMaintenance.php +++ b/app/Models/AssetMaintenance.php @@ -2,9 +2,9 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Helpers\Helper; use App\Models\Traits\Searchable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; @@ -17,7 +17,6 @@ use Watson\Validating\ValidatingTrait; class AssetMaintenance extends Model implements ICompanyableChild { use HasFactory; - use SoftDeletes; use CompanyableChildTrait; use ValidatingTrait; diff --git a/app/Models/AssetModel.php b/app/Models/AssetModel.php index 2d48f491fe..7968f84085 100755 --- a/app/Models/AssetModel.php +++ b/app/Models/AssetModel.php @@ -2,9 +2,9 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Searchable; use App\Presenters\Presentable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Storage; use Watson\Validating\ValidatingTrait; @@ -18,7 +18,6 @@ use Watson\Validating\ValidatingTrait; class AssetModel extends SnipeModel { use HasFactory; - use SoftDeletes; protected $presenter = \App\Presenters\AssetModelPresenter::class; use Requestable, Presentable; diff --git a/app/Models/Category.php b/app/Models/Category.php index 9c51fc4be4..36cad63ec7 100755 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -2,10 +2,10 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Http\Traits\UniqueUndeletedTrait; use App\Models\Traits\Searchable; use App\Presenters\Presentable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Gate; use Watson\Validating\ValidatingTrait; diff --git a/app/Models/Company.php b/app/Models/Company.php index dae7bd28d2..26afdb032e 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -2,11 +2,11 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Searchable; use App\Presenters\Presentable; use Auth; use DB; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Support\Facades\Gate; use Watson\Validating\ValidatingTrait; diff --git a/app/Models/Component.php b/app/Models/Component.php index 3c15d2dddb..eebd6a5403 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -2,9 +2,9 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Searchable; use App\Presenters\Presentable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php index 203a56e4b8..3903081b76 100644 --- a/app/Models/Consumable.php +++ b/app/Models/Consumable.php @@ -2,10 +2,10 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Acceptable; use App\Models\Traits\Searchable; use App\Presenters\Presentable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Storage; use Watson\Validating\ValidatingTrait; @@ -111,7 +111,6 @@ class Consumable extends SnipeModel $value = null; } $this->attributes['requestable'] = filter_var($value, FILTER_VALIDATE_BOOLEAN); - } /** diff --git a/app/Models/CustomField.php b/app/Models/CustomField.php index d601bb4ef3..0f58055254 100644 --- a/app/Models/CustomField.php +++ b/app/Models/CustomField.php @@ -2,9 +2,9 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Http\Traits\UniqueUndeletedTrait; use EasySlugger\Utf8Slugger; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Validation\Rule; use Schema; @@ -13,7 +13,6 @@ use Watson\Validating\ValidatingTrait; class CustomField extends Model { use HasFactory; - use ValidatingTrait, UniqueUndeletedTrait; diff --git a/app/Models/CustomFieldset.php b/app/Models/CustomFieldset.php index dbfb685f8f..bcbe0b81d9 100644 --- a/app/Models/CustomFieldset.php +++ b/app/Models/CustomFieldset.php @@ -2,15 +2,14 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Gate; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Watson\Validating\ValidatingTrait; class CustomFieldset extends Model { use HasFactory; - use ValidatingTrait; protected $guarded = ['id']; diff --git a/app/Models/Department.php b/app/Models/Department.php index 7b2adeb471..7be99d097b 100644 --- a/app/Models/Department.php +++ b/app/Models/Department.php @@ -2,9 +2,9 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Http\Traits\UniqueUndeletedTrait; use App\Models\Traits\Searchable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Watson\Validating\ValidatingTrait; class Department extends SnipeModel diff --git a/app/Models/Depreciation.php b/app/Models/Depreciation.php index 9734315f08..39fb935494 100755 --- a/app/Models/Depreciation.php +++ b/app/Models/Depreciation.php @@ -2,9 +2,9 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Searchable; use App\Presenters\Presentable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Watson\Validating\ValidatingTrait; class Depreciation extends SnipeModel diff --git a/app/Models/Group.php b/app/Models/Group.php index 5d9a01c31f..a68579adac 100755 --- a/app/Models/Group.php +++ b/app/Models/Group.php @@ -2,8 +2,8 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Searchable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Watson\Validating\ValidatingTrait; class Group extends SnipeModel diff --git a/app/Models/License.php b/app/Models/License.php index 8c2bf2d02b..21af9549cb 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -2,11 +2,11 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Searchable; use App\Presenters\Presentable; use Carbon\Carbon; use DB; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Session; @@ -26,7 +26,6 @@ class License extends Depreciable // We set these as protected dates so that they will be easily accessible via Carbon - public $timestamps = true; protected $guarded = 'id'; diff --git a/app/Models/Location.php b/app/Models/Location.php index a18eedc239..a85c8905e0 100755 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -2,7 +2,6 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Http\Traits\UniqueUndeletedTrait; use App\Models\Asset; use App\Models\SnipeModel; @@ -10,6 +9,7 @@ use App\Models\Traits\Searchable; use App\Models\User; use App\Presenters\Presentable; use DB; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Gate; @@ -131,7 +131,7 @@ class Location extends SnipeModel public function parent() { - return $this->belongsTo(\App\Models\Location::class, 'parent_id', 'id') + return $this->belongsTo(self::class, 'parent_id', 'id') ->with('parent'); } @@ -142,7 +142,7 @@ class Location extends SnipeModel public function children() { - return $this->hasMany(\App\Models\Location::class, 'parent_id') + return $this->hasMany(self::class, 'parent_id') ->with('children'); } diff --git a/app/Models/Manufacturer.php b/app/Models/Manufacturer.php index 6a96e36788..5f01c3c273 100755 --- a/app/Models/Manufacturer.php +++ b/app/Models/Manufacturer.php @@ -2,9 +2,9 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\Traits\Searchable; use App\Presenters\Presentable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Gate; use Watson\Validating\ValidatingTrait; diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 1721b78f44..b8ef8e685e 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -17,7 +17,6 @@ use Watson\Validating\ValidatingTrait; class Setting extends Model { use HasFactory; - use Notifiable, ValidatingTrait; /** diff --git a/app/Models/SnipeModel.php b/app/Models/SnipeModel.php index d220d27d93..e5a039a4e1 100644 --- a/app/Models/SnipeModel.php +++ b/app/Models/SnipeModel.php @@ -14,7 +14,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['purchase_date'] = $value; - } /** @@ -28,7 +27,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['purchase_cost'] = $value; - } public function setLocationIdAttribute($value) @@ -37,7 +35,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['location_id'] = $value; - } public function setCategoryIdAttribute($value) @@ -47,7 +44,6 @@ class SnipeModel extends Model } $this->attributes['category_id'] = $value; // dd($this->attributes); - } public function setSupplierIdAttribute($value) @@ -56,7 +52,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['supplier_id'] = $value; - } public function setDepreciationIdAttribute($value) @@ -65,7 +60,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['depreciation_id'] = $value; - } public function setManufacturerIdAttribute($value) @@ -74,7 +68,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['manufacturer_id'] = $value; - } public function setMinAmtAttribute($value) @@ -83,7 +76,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['min_amt'] = $value; - } public function setParentIdAttribute($value) @@ -92,7 +84,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['parent_id'] = $value; - } public function setFieldSetIdAttribute($value) @@ -101,7 +92,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['fieldset_id'] = $value; - } public function setCompanyIdAttribute($value) @@ -110,7 +100,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['company_id'] = $value; - } public function setWarrantyMonthsAttribute($value) @@ -119,7 +108,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['warranty_months'] = $value; - } public function setRtdLocationIdAttribute($value) @@ -128,7 +116,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['rtd_location_id'] = $value; - } public function setDepartmentIdAttribute($value) @@ -137,7 +124,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['department_id'] = $value; - } public function setManagerIdAttribute($value) @@ -146,7 +132,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['manager_id'] = $value; - } public function setModelIdAttribute($value) @@ -155,7 +140,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['model_id'] = $value; - } public function setStatusIdAttribute($value) @@ -164,7 +148,6 @@ class SnipeModel extends Model $value = null; } $this->attributes['status_id'] = $value; - } // diff --git a/app/Models/Statuslabel.php b/app/Models/Statuslabel.php index 47e2ec2517..ee824734e5 100755 --- a/app/Models/Statuslabel.php +++ b/app/Models/Statuslabel.php @@ -2,16 +2,15 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Http\Traits\UniqueUndeletedTrait; use App\Models\Traits\Searchable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; class Statuslabel extends SnipeModel { use HasFactory; - use SoftDeletes; use ValidatingTrait; use UniqueUndeletedTrait; diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index ad09721ce2..a96fdacdb6 100755 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -2,16 +2,15 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Http\Traits\UniqueUndeletedTrait; use App\Models\Traits\Searchable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; class Supplier extends SnipeModel { use HasFactory; - use SoftDeletes; protected $table = 'suppliers'; diff --git a/app/Models/User.php b/app/Models/User.php index b07f08c2d7..d42ea740e4 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,7 +2,6 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Http\Traits\UniqueUndeletedTrait; use App\Models\Traits\Searchable; use App\Presenters\Presentable; @@ -14,6 +13,7 @@ use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Contracts\Translation\HasLocalePreference; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\Access\Authorizable; use Illuminate\Notifications\Notifiable; @@ -330,7 +330,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo */ public function userlog() { - return $this->hasMany(\App\Models\Actionlog::class, 'target_id')->where('target_type', '=', \App\Models\User::class)->orderBy('created_at', 'DESC')->withTrashed(); + return $this->hasMany(\App\Models\Actionlog::class, 'target_id')->where('target_type', '=', self::class)->orderBy('created_at', 'DESC')->withTrashed(); } /** @@ -370,7 +370,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo */ public function manager() { - return $this->belongsTo(\App\Models\User::class, 'manager_id')->withTrashed(); + return $this->belongsTo(self::class, 'manager_id')->withTrashed(); } /** diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 57e9505d3f..16a22d8660 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,10 +2,10 @@ namespace App\Providers; -use Illuminate\Support\Facades\RateLimiter; -use Illuminate\Http\Request; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider @@ -28,8 +28,6 @@ class RouteServiceProvider extends ServiceProvider }); } - - /** * Define the "web" routes for the application. * diff --git a/database/factories/AccessoryFactory.php b/database/factories/AccessoryFactory.php index 224241da0c..84edcb705c 100644 --- a/database/factories/AccessoryFactory.php +++ b/database/factories/AccessoryFactory.php @@ -1,7 +1,8 @@ defineAs(App\Models\Actionlog::class, 'asset-upload', function ($faker) { $asset = \App\Models\Asset::factory()->create(); diff --git a/database/factories/AssetFactory.php b/database/factories/AssetFactory.php index d4bae8f8c4..f4a5b73807 100644 --- a/database/factories/AssetFactory.php +++ b/database/factories/AssetFactory.php @@ -2,10 +2,10 @@ namespace Database\Factories; -use Illuminate\Database\Eloquent\Factories\Factory; use App\Models\Asset; use App\Models\AssetModel; use App\Models\Category; +use Illuminate\Database\Eloquent\Factories\Factory; /* |-------------------------------------------------------------------------- @@ -16,27 +16,6 @@ use App\Models\Category; | */ - - - - - - - - - - - - - - - - - - - - - // These are just for unit tests, not to generate data class AssetFactory extends Factory diff --git a/database/factories/AssetMaintenanceFactory.php b/database/factories/AssetMaintenanceFactory.php index b3793c822c..f9351f5188 100644 --- a/database/factories/AssetMaintenanceFactory.php +++ b/database/factories/AssetMaintenanceFactory.php @@ -2,10 +2,10 @@ namespace Database\Factories; -use Illuminate\Database\Eloquent\Factories\Factory; use App\Models\Asset; use App\Models\AssetModel; use App\Models\Category; +use Illuminate\Database\Eloquent\Factories\Factory; /* |-------------------------------------------------------------------------- diff --git a/database/factories/AssetModelFactory.php b/database/factories/AssetModelFactory.php index 38391b1712..bd9bb5aa69 100644 --- a/database/factories/AssetModelFactory.php +++ b/database/factories/AssetModelFactory.php @@ -1,7 +1,8 @@ delete($dst.$del_file); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } $add_files = glob($src.'/*.*'); foreach ($add_files as $add_file) { $file_to_copy = str_replace($src, '', $add_file); - \Log::debug('Copying: '.$file_to_copy); + Log::debug('Copying: '.$file_to_copy); try { Storage::disk('public')->put($dst.$file_to_copy, file_get_contents($src.$file_to_copy)); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } } diff --git a/database/seeders/AssetModelSeeder.php b/database/seeders/AssetModelSeeder.php index e22525442b..e8816cc509 100755 --- a/database/seeders/AssetModelSeeder.php +++ b/database/seeders/AssetModelSeeder.php @@ -4,6 +4,7 @@ namespace Database\Seeders; use App\Models\AssetModel; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; class AssetModelSeeder extends Seeder @@ -48,22 +49,22 @@ class AssetModelSeeder extends Seeder foreach ($del_files as $del_file) { // iterate files $file_to_delete = str_replace($src, '', $del_file); - \Log::debug('Deleting: '.$file_to_delete); + Log::debug('Deleting: '.$file_to_delete); try { Storage::disk('public')->delete($dst.$del_file); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } $add_files = glob($src.'/*.*'); foreach ($add_files as $add_file) { $file_to_copy = str_replace($src, '', $add_file); - \Log::debug('Copying: '.$file_to_copy); + Log::debug('Copying: '.$file_to_copy); try { Storage::disk('public')->put($dst.$file_to_copy, file_get_contents($src.$file_to_copy)); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } } diff --git a/database/seeders/AssetSeeder.php b/database/seeders/AssetSeeder.php index fa2c23b85b..082e6b66af 100644 --- a/database/seeders/AssetSeeder.php +++ b/database/seeders/AssetSeeder.php @@ -4,6 +4,8 @@ namespace Database\Seeders; use App\Models\Asset; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; class AssetSeeder extends Seeder @@ -39,11 +41,11 @@ class AssetSeeder extends Seeder $del_files = Storage::files('assets'); foreach ($del_files as $del_file) { // iterate files - \Log::debug('Deleting: '.$del_files); + Log::debug('Deleting: '.$del_files); try { Storage::disk('public')->delete('assets'.'/'.$del_files); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } diff --git a/database/seeders/CompanySeeder.php b/database/seeders/CompanySeeder.php index a61c478433..04f9190f7c 100644 --- a/database/seeders/CompanySeeder.php +++ b/database/seeders/CompanySeeder.php @@ -4,6 +4,8 @@ namespace Database\Seeders; use App\Models\Company; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; class CompanySeeder extends Seeder { @@ -14,7 +16,7 @@ class CompanySeeder extends Seeder */ public function run() { - \Log::debug('Seed companies'); + Log::debug('Seed companies'); Company::truncate(); Company::factory()->count(4)->create(); @@ -24,22 +26,22 @@ class CompanySeeder extends Seeder foreach ($del_files as $del_file) { // iterate files $file_to_delete = str_replace($src, '', $del_file); - \Log::debug('Deleting: '.$file_to_delete); + Log::debug('Deleting: '.$file_to_delete); try { Storage::disk('public')->delete($dst.$del_file); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } $add_files = glob($src.'/*.*'); foreach ($add_files as $add_file) { $file_to_copy = str_replace($src, '', $add_file); - \Log::debug('Copying: '.$file_to_copy); + Log::debug('Copying: '.$file_to_copy); try { Storage::disk('public')->put($dst.$file_to_copy, file_get_contents($src.$file_to_copy)); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } } diff --git a/database/seeders/ComponentSeeder.php b/database/seeders/ComponentSeeder.php index 5d58889ec1..46380e1682 100644 --- a/database/seeders/ComponentSeeder.php +++ b/database/seeders/ComponentSeeder.php @@ -4,6 +4,7 @@ namespace Database\Seeders; use App\Models\Component; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\DB; class ComponentSeeder extends Seeder { diff --git a/database/seeders/ConsumableSeeder.php b/database/seeders/ConsumableSeeder.php index e691ce837f..240741fe6d 100644 --- a/database/seeders/ConsumableSeeder.php +++ b/database/seeders/ConsumableSeeder.php @@ -4,6 +4,7 @@ namespace Database\Seeders; use App\Models\Consumable; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\DB; class ConsumableSeeder extends Seeder { diff --git a/database/seeders/CustomFieldSeeder.php b/database/seeders/CustomFieldSeeder.php index 643c88d1a2..8776872644 100644 --- a/database/seeders/CustomFieldSeeder.php +++ b/database/seeders/CustomFieldSeeder.php @@ -6,6 +6,7 @@ use App\Models\CustomField; use App\Models\CustomFieldset; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; class CustomFieldSeeder extends Seeder diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index e92693c2dc..54fb1e088b 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -2,18 +2,21 @@ namespace Database\Seeders; -use Database\Seeders\CustomFieldSeeder; -use Database\Seeders\ConsumableSeeder; -use Database\Seeders\ComponentSeeder; -use Database\Seeders\CompanySeeder; -use Database\Seeders\CategorySeeder; -use Database\Seeders\AssetSeeder; -use Database\Seeders\AssetModelSeeder; -use Database\Seeders\ActionlogSeeder; -use Database\Seeders\AccessorySeeder; use App\Models\Setting; +use Database\Seeders\AccessorySeeder; +use Database\Seeders\ActionlogSeeder; +use Database\Seeders\AssetModelSeeder; +use Database\Seeders\AssetSeeder; +use Database\Seeders\CategorySeeder; +use Database\Seeders\CompanySeeder; +use Database\Seeders\ComponentSeeder; +use Database\Seeders\ConsumableSeeder; +use Database\Seeders\CustomFieldSeeder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\Artisan; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; class DatabaseSeeder extends Seeder { @@ -53,7 +56,7 @@ class DatabaseSeeder extends Seeder Artisan::call('snipeit:sync-asset-locations', ['--output' => 'all']); $output = Artisan::output(); - \Log::info($output); + Log::info($output); Model::reguard(); diff --git a/database/seeders/LocationSeeder.php b/database/seeders/LocationSeeder.php index 969587c067..4a98ecb9e8 100644 --- a/database/seeders/LocationSeeder.php +++ b/database/seeders/LocationSeeder.php @@ -4,6 +4,7 @@ namespace Database\Seeders; use App\Models\Location; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; class LocationSeeder extends Seeder @@ -19,22 +20,22 @@ class LocationSeeder extends Seeder foreach ($del_files as $del_file) { // iterate files $file_to_delete = str_replace($src, '', $del_file); - \Log::debug('Deleting: '.$file_to_delete); + Log::debug('Deleting: '.$file_to_delete); try { Storage::disk('public')->delete($dst.$del_file); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } $add_files = glob($src.'/*.*'); foreach ($add_files as $add_file) { $file_to_copy = str_replace($src, '', $add_file); - \Log::debug('Copying: '.$file_to_copy); + Log::debug('Copying: '.$file_to_copy); try { Storage::disk('public')->put($dst.$file_to_copy, file_get_contents($src.$file_to_copy)); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } } diff --git a/database/seeders/ManufacturerSeeder.php b/database/seeders/ManufacturerSeeder.php index a36d92b4c5..fc6a3c34e9 100644 --- a/database/seeders/ManufacturerSeeder.php +++ b/database/seeders/ManufacturerSeeder.php @@ -4,6 +4,7 @@ namespace Database\Seeders; use App\Models\Manufacturer; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; class ManufacturerSeeder extends Seeder @@ -29,22 +30,22 @@ class ManufacturerSeeder extends Seeder foreach ($del_files as $del_file) { // iterate files $file_to_delete = str_replace($src, '', $del_file); - \Log::debug('Deleting: '.$file_to_delete); + Log::debug('Deleting: '.$file_to_delete); try { Storage::disk('public')->delete($dst.$del_file); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } $add_files = glob($src.'/*.*'); foreach ($add_files as $add_file) { $file_to_copy = str_replace($src, '', $add_file); - \Log::debug('Copying: '.$file_to_copy); + Log::debug('Copying: '.$file_to_copy); try { Storage::disk('public')->put($dst.$file_to_copy, file_get_contents($src.$file_to_copy)); } catch (\Exception $e) { - \Log::debug($e); + Log::debug($e); } } } diff --git a/database/seeders/SettingsSeeder.php b/database/seeders/SettingsSeeder.php index 185104153c..9cbdf79f94 100644 --- a/database/seeders/SettingsSeeder.php +++ b/database/seeders/SettingsSeeder.php @@ -5,6 +5,7 @@ namespace Database\Seeders; use App\Models\Setting; use App\Models\User; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\Storage; class SettingsSeeder extends Seeder { diff --git a/routes/api.php b/routes/api.php index df2570c9ef..6229230357 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,9 +1,8 @@