A free open source IT asset/license management system
Continue converting query scopes into builders
snipe1e116b4fa761
diff --git a/app/Http/Controllers/Api/CategoriesController.php b/app/Http/Controllers/Api/CategoriesController.phpindex d5aafb0dba..17c1250913 100644--- a/app/Http/Controllers/Api/CategoriesController.php+++ b/app/Http/Controllers/Api/CategoriesController.php@@ -53,19 +53,19 @@ class CategoriesController extends Controller];$categories = Category::select([- 'category_type',- 'checkin_email',- 'created_at',- 'created_by',- 'eula_text',- 'id',- 'image',- 'name',- 'notes',- 'require_acceptance',- 'tag_color',- 'updated_at',- 'use_default_eula',+ 'categories.category_type',+ 'categories.checkin_email',+ 'categories.created_at',+ 'categories.created_by',+ 'categories.eula_text',+ 'categories.id',+ 'categories.image',+ 'categories.name',+ 'categories.notes',+ 'categories.require_acceptance',+ 'categories.tag_color',+ 'categories.updated_at',+ 'categories.use_default_eula',])->with('adminuser')->withCount('accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count', 'models as models_count');diff --git a/app/Http/Controllers/Api/DepreciationsController.php b/app/Http/Controllers/Api/DepreciationsController.phpindex 49cc892329..55a9306175 100644--- a/app/Http/Controllers/Api/DepreciationsController.php+++ b/app/Http/Controllers/Api/DepreciationsController.php@@ -34,7 +34,7 @@ class DepreciationsController extends Controller'licenses_count',];- $depreciations = Depreciation::select(['id', 'name', 'months', 'depreciation_min', 'depreciation_type', 'created_at', 'updated_at', 'created_by'])+ $depreciations = Depreciation::select(['depreciations.id', 'depreciations.name', 'depreciations.months', 'depreciations.depreciation_min', 'depreciations.depreciation_type', 'depreciations.created_at', 'depreciations.updated_at', 'depreciations.created_by'])->with('adminuser')->withCount('assets as assets_count')->withCount('models as models_count')diff --git a/app/Http/Controllers/Api/GroupsController.php b/app/Http/Controllers/Api/GroupsController.phpindex 4b72d7db78..d063b4652b 100644--- a/app/Http/Controllers/Api/GroupsController.php+++ b/app/Http/Controllers/Api/GroupsController.php@@ -27,7 +27,7 @@ class GroupsController extends Controller$this->authorize('view', Group::class);- $groups = Group::select(['id', 'name', 'permissions', 'notes', 'created_at', 'updated_at', 'created_by'])->with('adminuser')->withCount('users as users_count');+ $groups = Group::select(['permission_groups.id', 'permission_groups.name', 'permission_groups.permissions', 'permission_groups.notes', 'permission_groups.created_at', 'permission_groups.updated_at', 'permission_groups.created_by'])->with('adminuser')->withCount('users as users_count');// This invokes the Searchable model trait scopeTextSearch and will handle input by search or by advanced search filterif ($request->filled('filter') || $request->filled('search')) {@@ -178,7 +178,7 @@ class GroupsController extends Controller$groups = Group::select(['id', 'name']);if ($request->filled('search')) {- $groups->where('name', 'LIKE', '%' . $request->input('search') . '%');+ $groups->where('name', 'LIKE', '%'.$request->input('search').'%');}$sorted = $groups->orderBy('name', 'asc')->get();diff --git a/app/Http/Controllers/Api/ManufacturersController.php b/app/Http/Controllers/Api/ManufacturersController.phpindex c97451e67e..fd1ee27b5d 100644--- a/app/Http/Controllers/Api/ManufacturersController.php+++ b/app/Http/Controllers/Api/ManufacturersController.php@@ -55,20 +55,20 @@ class ManufacturersController extends Controller];$manufacturers = Manufacturer::select([- 'id',- 'name',- 'url',- 'support_url',- 'warranty_lookup_url',- 'support_email',- 'support_phone',- 'created_by',- 'created_at',- 'updated_at',- 'image',- 'deleted_at',- 'tag_color',- 'notes',+ 'manufacturers.id',+ 'manufacturers.name',+ 'manufacturers.url',+ 'manufacturers.support_url',+ 'manufacturers.warranty_lookup_url',+ 'manufacturers.support_email',+ 'manufacturers.support_phone',+ 'manufacturers.created_by',+ 'manufacturers.created_at',+ 'manufacturers.updated_at',+ 'manufacturers.image',+ 'manufacturers.deleted_at',+ 'manufacturers.tag_color',+ 'manufacturers.notes',])->with('adminuser')->withCount('assets as assets_count')diff --git a/app/Http/Controllers/Api/SuppliersController.php b/app/Http/Controllers/Api/SuppliersController.phpindex 11b7a60b54..1785d3935d 100644--- a/app/Http/Controllers/Api/SuppliersController.php+++ b/app/Http/Controllers/Api/SuppliersController.php@@ -62,7 +62,7 @@ class SuppliersController extends Controller];$suppliers = Supplier::select(- ['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'created_by', 'updated_at', 'deleted_at', 'image', 'notes', 'url', 'zip', 'tag_color'])+ ['suppliers.id', 'suppliers.name', 'suppliers.address', 'suppliers.address2', 'suppliers.city', 'suppliers.state', 'suppliers.country', 'suppliers.fax', 'suppliers.phone', 'suppliers.email', 'suppliers.contact', 'suppliers.created_at', 'suppliers.created_by', 'suppliers.updated_at', 'suppliers.deleted_at', 'suppliers.image', 'suppliers.notes', 'suppliers.url', 'suppliers.zip', 'suppliers.tag_color'])->withCount('assets as assets_count')->withCount('licenses as licenses_count')->withCount('accessories as accessories_count')diff --git a/app/Models/Builders/CategoryQueryBuilder.php b/app/Models/Builders/CategoryQueryBuilder.phpnew file mode 100644index 0000000000..8b554d303e--- /dev/null+++ b/app/Models/Builders/CategoryQueryBuilder.php@@ -0,0 +1,22 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class CategoryQueryBuilder extends Builder+{+ public function requiresAcceptance(): static+ {+ return $this->where('require_acceptance', '=', true);+ }++ public function orderByCreatedBy(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'categories.created_by', '=', 'admin_sort.id')+ ->addSelect('categories.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Builders/DepartmentQueryBuilder.php b/app/Models/Builders/DepartmentQueryBuilder.phpnew file mode 100644index 0000000000..32843b0b70--- /dev/null+++ b/app/Models/Builders/DepartmentQueryBuilder.php@@ -0,0 +1,39 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class DepartmentQueryBuilder extends Builder+{+ public function orderLocation(string $order): static+ {+ return $this+ ->leftJoin('locations as department_location', 'departments.location_id', '=', 'department_location.id')+ ->orderBy('department_location.name', $order);+ }++ public function orderManager(string $order): static+ {+ return $this+ ->leftJoin('users as department_user', 'departments.manager_id', '=', 'department_user.id')+ ->orderBy('department_user.first_name', $order)+ ->orderBy('department_user.last_name', $order);+ }++ public function orderCompany(string $order): static+ {+ return $this+ ->leftJoin('companies as company_sort', 'departments.company_id', '=', 'company_sort.id')+ ->orderBy('company_sort.name', $order);+ }++ public function orderByCreatedBy(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'departments.created_by', '=', 'admin_sort.id')+ ->addSelect('departments.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Builders/DepreciationQueryBuilder.php b/app/Models/Builders/DepreciationQueryBuilder.phpnew file mode 100644index 0000000000..0a33ae1ed7--- /dev/null+++ b/app/Models/Builders/DepreciationQueryBuilder.php@@ -0,0 +1,17 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class DepreciationQueryBuilder extends Builder+{+ public function orderByCreatedBy(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'depreciations.created_by', '=', 'admin_sort.id')+ ->addSelect('depreciations.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Builders/GroupQueryBuilder.php b/app/Models/Builders/GroupQueryBuilder.phpnew file mode 100644index 0000000000..2e4c790881--- /dev/null+++ b/app/Models/Builders/GroupQueryBuilder.php@@ -0,0 +1,17 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class GroupQueryBuilder extends Builder+{+ public function orderByCreatedBy(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'permission_groups.created_by', '=', 'admin_sort.id')+ ->addSelect('permission_groups.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Builders/LocationQueryBuilder.php b/app/Models/Builders/LocationQueryBuilder.phpnew file mode 100644index 0000000000..e4ca60e851--- /dev/null+++ b/app/Models/Builders/LocationQueryBuilder.php@@ -0,0 +1,40 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class LocationQueryBuilder extends Builder+{+ public function orderParent(string $order): static+ {+ // Left join here, or it will only return results with parents+ return $this+ ->leftJoin('locations as parent_loc', 'locations.parent_id', '=', 'parent_loc.id')+ ->orderBy('parent_loc.name', $order);+ }++ public function orderManager(string $order): static+ {+ return $this+ ->leftJoin('users as location_user', 'locations.manager_id', '=', 'location_user.id')+ ->orderBy('location_user.first_name', $order)+ ->orderBy('location_user.last_name', $order);+ }++ public function orderCompany(string $order): static+ {+ return $this+ ->leftJoin('companies as company_sort', 'locations.company_id', '=', 'company_sort.id')+ ->orderBy('company_sort.name', $order);+ }++ public function orderByCreatedByName(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'locations.created_by', '=', 'admin_sort.id')+ ->addSelect('locations.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Builders/ManufacturerQueryBuilder.php b/app/Models/Builders/ManufacturerQueryBuilder.phpnew file mode 100644index 0000000000..f82ead73a6--- /dev/null+++ b/app/Models/Builders/ManufacturerQueryBuilder.php@@ -0,0 +1,17 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class ManufacturerQueryBuilder extends Builder+{+ public function orderByCreatedBy(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'manufacturers.created_by', '=', 'admin_sort.id')+ ->addSelect('manufacturers.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Builders/PredefinedKitQueryBuilder.php b/app/Models/Builders/PredefinedKitQueryBuilder.phpnew file mode 100644index 0000000000..9d0f0fec0a--- /dev/null+++ b/app/Models/Builders/PredefinedKitQueryBuilder.php@@ -0,0 +1,17 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class PredefinedKitQueryBuilder extends Builder+{+ public function orderByCreatedBy(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'kits.created_by', '=', 'admin_sort.id')+ ->addSelect('kits.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Builders/StatuslabelQueryBuilder.php b/app/Models/Builders/StatuslabelQueryBuilder.phpnew file mode 100644index 0000000000..7ef4924aa6--- /dev/null+++ b/app/Models/Builders/StatuslabelQueryBuilder.php@@ -0,0 +1,45 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class StatuslabelQueryBuilder extends Builder+{+ public function pending(): static+ {+ return $this->where('pending', '=', 1)+ ->where('archived', '=', 0)+ ->where('deployable', '=', 0);+ }++ public function archived(): static+ {+ return $this->where('pending', '=', 0)+ ->where('archived', '=', 1)+ ->where('deployable', '=', 0);+ }++ public function deployable(): static+ {+ return $this->where('pending', '=', 0)+ ->where('archived', '=', 0)+ ->where('deployable', '=', 1);+ }++ public function undeployable(): static+ {+ return $this->where('pending', '=', 0)+ ->where('archived', '=', 0)+ ->where('deployable', '=', 0);+ }++ public function orderByCreatedBy(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'status_labels.created_by', '=', 'admin_sort.id')+ ->addSelect('status_labels.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Builders/SupplierQueryBuilder.php b/app/Models/Builders/SupplierQueryBuilder.phpnew file mode 100644index 0000000000..21d331a690--- /dev/null+++ b/app/Models/Builders/SupplierQueryBuilder.php@@ -0,0 +1,17 @@+<?php++namespace App\Models\Builders;++use Illuminate\Database\Eloquent\Builder;++class SupplierQueryBuilder extends Builder+{+ public function orderByCreatedByName(string $order): static+ {+ return $this+ ->leftJoin('users as admin_sort', 'suppliers.created_by', '=', 'admin_sort.id')+ ->addSelect('suppliers.*')+ ->orderBy('admin_sort.first_name', $order)+ ->orderBy('admin_sort.last_name', $order);+ }+}diff --git a/app/Models/Category.php b/app/Models/Category.phpindex 590252c0f4..4e1eaacb15 100755--- a/app/Models/Category.php+++ b/app/Models/Category.php@@ -4,6 +4,7 @@ namespace App\Models;use App\Enums\FileStorage;use App\Http\Traits\TwoColumnUniqueUndeletedTrait;+use App\Models\Builders\CategoryQueryBuilder;use App\Models\Traits\Searchable;use App\Presenters\CategoryPresenter;use App\Presenters\Presentable;@@ -363,13 +364,8 @@ class Category extends SnipeModel* @param Builder $query Query builder instance* @return Builder Modified query builder*/- public function scopeRequiresAcceptance($query)+ public function newEloquentBuilder($query): CategoryQueryBuilder{- return $query->where('require_acceptance', '=', true);- }-- public function scopeOrderByCreatedBy($query, $order)- {- return $query->leftJoin('users as admin_sort', 'categories.created_by', '=', 'admin_sort.id')->addSelect('categories.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new CategoryQueryBuilder($query);}}diff --git a/app/Models/Department.php b/app/Models/Department.phpindex 45011f477a..f3d924bb4c 100644--- a/app/Models/Department.php+++ b/app/Models/Department.php@@ -4,6 +4,7 @@ namespace App\Models;use App\Enums\FileStorage;use App\Http\Traits\UniqueUndeletedTrait;+use App\Models\Builders\DepartmentQueryBuilder;use App\Models\Traits\CompanyableTrait;use App\Models\Traits\HasUploads;use App\Models\Traits\Loggable;@@ -13,7 +14,6 @@ use App\Presenters\Presentable;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Relations\Relation;use Illuminate\Database\Eloquent\SoftDeletes;-use Illuminate\Database\Query\Builder;use Illuminate\Support\Facades\Gate;use Illuminate\Support\Facades\Log;use Illuminate\Support\Facades\Storage;@@ -191,44 +191,8 @@ class Department extends SnipeModelreturn $this->belongsTo(Location::class, 'location_id');}- /**- * Query builder scope to order on location name- *- * @param Builder $query Query builder instance- * @param text $order Order- * @return Builder Modified query builder- */- public function scopeOrderLocation($query, $order)- {- return $query->leftJoin('locations as department_location', 'departments.location_id', '=', 'department_location.id')->orderBy('department_location.name', $order);- }-- /**- * Query builder scope to order on manager name- *- * @param Builder $query Query builder instance- * @param text $order Order- * @return Builder Modified query builder- */- public function scopeOrderManager($query, $order)- {- return $query->leftJoin('users as department_user', 'departments.manager_id', '=', 'department_user.id')->orderBy('department_user.first_name', $order)->orderBy('department_user.last_name', $order);- }-- /**- * Query builder scope to order on company- *- * @param Builder $query Query builder instance- * @param text $order Order- * @return Builder Modified query builder- */- public function scopeOrderCompany($query, $order)- {- return $query->leftJoin('companies as company_sort', 'departments.company_id', '=', 'company_sort.id')->orderBy('company_sort.name', $order);- }-- public function scopeOrderByCreatedBy($query, $order)+ public function newEloquentBuilder($query): DepartmentQueryBuilder{- return $query->leftJoin('users as admin_sort', 'departments.created_by', '=', 'admin_sort.id')->addSelect('departments.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new DepartmentQueryBuilder($query);}}diff --git a/app/Models/Depreciation.php b/app/Models/Depreciation.phpindex 2eac2f3d36..7e469c4bbb 100755--- a/app/Models/Depreciation.php+++ b/app/Models/Depreciation.php@@ -2,6 +2,7 @@namespace App\Models;+use App\Models\Builders\DepreciationQueryBuilder;use App\Models\Traits\Searchable;use App\Presenters\DepreciationPresenter;use App\Presenters\Presentable;@@ -131,13 +132,8 @@ class Depreciation extends SnipeModelreturn $this->belongsTo(User::class, 'created_by')->withTrashed();}- /**- * ------------------------------------------------ * BEGIN QUERY SCOPES- * ------------------------------------------------ **/- public function scopeOrderByCreatedBy($query, $order)+ public function newEloquentBuilder($query): DepreciationQueryBuilder{- return $query->leftJoin('users as admin_sort', 'depreciations.created_by', '=', 'admin_sort.id')->addSelect('depreciations.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new DepreciationQueryBuilder($query);}}diff --git a/app/Models/Group.php b/app/Models/Group.phpindex c655ff2a33..898e9d609d 100755--- a/app/Models/Group.php+++ b/app/Models/Group.php@@ -2,6 +2,7 @@namespace App\Models;+use App\Models\Builders\GroupQueryBuilder;use App\Models\Traits\Searchable;use App\Presenters\GroupPresenter;use App\Presenters\Presentable;@@ -134,13 +135,8 @@ class Group extends SnipeModel}- /**- * ------------------------------------------------ * BEGIN QUERY SCOPES- * ------------------------------------------------ **/- public function scopeOrderByCreatedBy($query, $order)+ public function newEloquentBuilder($query): GroupQueryBuilder{- return $query->leftJoin('users as admin_sort', 'permission_groups.created_by', '=', 'admin_sort.id')->addSelect('permission_groups.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new GroupQueryBuilder($query);}}diff --git a/app/Models/Location.php b/app/Models/Location.phpindex 1e9ec38bb4..0f60f36b5e 100755--- a/app/Models/Location.php+++ b/app/Models/Location.php@@ -4,6 +4,7 @@ namespace App\Models;use App\Enums\FileStorage;use App\Http\Traits\UniqueUndeletedTrait;+use App\Models\Builders\LocationQueryBuilder;use App\Models\Traits\CompanyableTrait;use App\Models\Traits\HasUploads;use App\Models\Traits\Loggable;@@ -437,48 +438,8 @@ class Location extends SnipeModelreturn $results;}- /**- * Query builder scope to order on parent- *- * @param Illuminate\Database\Query\Builder $query Query builder instance- * @param text $order Order- * @return Illuminate\Database\Query\Builder Modified query builder- */- public function scopeOrderParent($query, $order)- {- // Left join here, or it will only return results with parents- return $query->leftJoin('locations as parent_loc', 'locations.parent_id', '=', 'parent_loc.id')->orderBy('parent_loc.name', $order);- }-- /**- * Query builder scope to order on manager name- *- * @param Builder $query Query builder instance- * @param text $order Order- * @return Builder Modified query builder- */- public function scopeOrderManager($query, $order)- {- return $query->leftJoin('users as location_user', 'locations.manager_id', '=', 'location_user.id')->orderBy('location_user.first_name', $order)->orderBy('location_user.last_name', $order);- }-- /**- * Query builder scope to order on company- *- * @param Builder $query Query builder instance- * @param text $order Order- * @return Builder Modified query builder- */- public function scopeOrderCompany($query, $order)- {- return $query->leftJoin('companies as company_sort', 'locations.company_id', '=', 'company_sort.id')->orderBy('company_sort.name', $order);- }-- /**- * Query builder scope to order on the user that created it- */- public function scopeOrderByCreatedByName($query, $order)+ public function newEloquentBuilder($query): LocationQueryBuilder{- return $query->leftJoin('users as admin_sort', 'locations.created_by', '=', 'admin_sort.id')->addSelect('locations.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new LocationQueryBuilder($query);}}diff --git a/app/Models/Manufacturer.php b/app/Models/Manufacturer.phpindex d334043dd0..e0b8ec5f7c 100755--- a/app/Models/Manufacturer.php+++ b/app/Models/Manufacturer.php@@ -3,6 +3,7 @@namespace App\Models;use App\Enums\FileStorage;+use App\Models\Builders\ManufacturerQueryBuilder;use App\Models\Traits\Searchable;use App\Presenters\ManufacturerPresenter;use App\Presenters\Presentable;@@ -143,11 +144,8 @@ class Manufacturer extends SnipeModelreturn $this->hasMany(Component::class, 'manufacturer_id');}- /**- * Query builder scope to order on the user that created it- */- public function scopeOrderByCreatedBy($query, $order)+ public function newEloquentBuilder($query): ManufacturerQueryBuilder{- return $query->leftJoin('users as admin_sort', 'manufacturers.created_by', '=', 'admin_sort.id')->addSelect('manufacturers.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new ManufacturerQueryBuilder($query);}}diff --git a/app/Models/PredefinedKit.php b/app/Models/PredefinedKit.phpindex db578d6c21..a8debfd7d3 100644--- a/app/Models/PredefinedKit.php+++ b/app/Models/PredefinedKit.php@@ -2,6 +2,7 @@namespace App\Models;+use App\Models\Builders\PredefinedKitQueryBuilder;use App\Models\Traits\Searchable;use App\Presenters\PredefinedKitPresenter;use App\Presenters\Presentable;@@ -192,13 +193,8 @@ class PredefinedKit extends SnipeModelreturn $this->belongsToMany(Accessory::class, 'kits_accessories', 'kit_id', 'accessory_id')->withPivot('id', 'quantity');}- /**- * ------------------------------------------------ * BEGIN QUERY SCOPES- * ------------------------------------------------ **/- public function scopeOrderByCreatedBy($query, $order)+ public function newEloquentBuilder($query): PredefinedKitQueryBuilder{- return $query->leftJoin('users as admin_sort', 'kits.created_by', '=', 'admin_sort.id')->addSelect('kits.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new PredefinedKitQueryBuilder($query);}}diff --git a/app/Models/Statuslabel.php b/app/Models/Statuslabel.phpindex 8b9c9541d2..8ddd890f64 100755--- a/app/Models/Statuslabel.php+++ b/app/Models/Statuslabel.php@@ -3,6 +3,7 @@namespace App\Models;use App\Http\Traits\UniqueUndeletedTrait;+use App\Models\Builders\StatuslabelQueryBuilder;use App\Models\Traits\Searchable;use App\Presenters\Presentable;use App\Presenters\StatusLabelPresenter;@@ -11,7 +12,6 @@ use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Relations\Relation;use Illuminate\Database\Eloquent\SoftDeletes;-use Illuminate\Database\Query\Builder;use Illuminate\Support\Collection;use Illuminate\Support\Facades\Gate;use Watson\Validating\ValidatingTrait;@@ -167,54 +167,6 @@ class Statuslabel extends SnipeModelreturn 'deployable';}- /**- * Query builder scope to for pending status types- *- * @return Builder Modified query builder- */- public function scopePending()- {- return $this->where('pending', '=', 1)- ->where('archived', '=', 0)- ->where('deployable', '=', 0);- }-- /**- * Query builder scope for archived status types- *- * @return Builder Modified query builder- */- public function scopeArchived()- {- return $this->where('pending', '=', 0)- ->where('archived', '=', 1)- ->where('deployable', '=', 0);- }-- /**- * Query builder scope for deployable status types- *- * @return Builder Modified query builder- */- public function scopeDeployable()- {- return $this->where('pending', '=', 0)- ->where('archived', '=', 0)- ->where('deployable', '=', 1);- }-- /**- * Query builder scope for undeployable status types- *- * @return Builder Modified query builder- */- public function scopeUndeployable()- {- return $this->where('pending', '=', 0)- ->where('archived', '=', 0)- ->where('deployable', '=', 0);- }-/*** Helper function to determine type attributes*@@ -247,8 +199,8 @@ class Statuslabel extends SnipeModelreturn $statustype;}- public function scopeOrderByCreatedBy($query, $order)+ public function newEloquentBuilder($query): StatuslabelQueryBuilder{- return $query->leftJoin('users as admin_sort', 'status_labels.created_by', '=', 'admin_sort.id')->addSelect('status_labels.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new StatuslabelQueryBuilder($query);}}diff --git a/app/Models/Supplier.php b/app/Models/Supplier.phpindex 7b370f64d0..adcb6cd234 100755--- a/app/Models/Supplier.php+++ b/app/Models/Supplier.php@@ -4,6 +4,7 @@ namespace App\Models;use App\Enums\FileStorage;use App\Http\Traits\UniqueUndeletedTrait;+use App\Models\Builders\SupplierQueryBuilder;use App\Models\Traits\HasUploads;use App\Models\Traits\Loggable;use App\Models\Traits\Searchable;@@ -288,11 +289,8 @@ class Supplier extends SnipeModelreturn $url;}- /**- * Query builder scope to order on the user that created it- */- public function scopeOrderByCreatedByName($query, $order)+ public function newEloquentBuilder($query): SupplierQueryBuilder{- return $query->leftJoin('users as admin_sort', 'suppliers.created_by', '=', 'admin_sort.id')->addSelect('suppliers.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);+ return new SupplierQueryBuilder($query);}}diff --git a/phpstan-baseline.neon b/phpstan-baseline.neonindex e6ae69de29..963645c6b8 100644--- a/phpstan-baseline.neon+++ b/phpstan-baseline.neon@@ -1,5 +1,11 @@parameters:ignoreErrors:+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Builder\<App\\Models\\Category\>\:\:requiresAcceptance\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Actions/Acceptances/RegenerateAcceptancesAction.php+-message: '#^Access to an undefined property App\\Models\\Actionlog\:\:\$created_by\.$#'identifier: property.notFound@@ -300,6 +306,84 @@ parameters:count: 2path: app/Console/Commands/GeneratePersonalAccessToken.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$address\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$address2\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$city\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$country\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$currency\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 2+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$ldap_ou\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 4+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$parent_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$state\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$zip\.$#'+ identifier: property.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:isValid\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Console/Commands/ImportLocations.php+-message: '#^Result of method Illuminate\\Console\\Command\:\:error\(\) \(void\) is used\.$#'identifier: method.void@@ -312,6 +396,18 @@ parameters:count: 1path: app/Console/Commands/LdapSync.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 3+ path: app/Console/Commands/LdapSync.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 2+ path: app/Console/Commands/LdapSync.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'identifier: method.notFound@@ -319,7 +415,7 @@ parameters:path: app/Console/Commands/LdapSync.php-- message: '#^Call to function is_array\(\) with App\\Models\\Location will always evaluate to false\.$#'+ message: '#^Call to function is_array\(\) with Illuminate\\Database\\Eloquent\\Model will always evaluate to false\.$#'identifier: function.impossibleTypecount: 1path: app/Console/Commands/LdapSync.php@@ -684,6 +780,78 @@ parameters:count: 1path: app/Helpers/Helper.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$accessories\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$assets\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$assignedAccessories\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$assignedAssets\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$children\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$components\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$consumables\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$manager\.$#'+ identifier: property.notFound+ count: 3+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$parent\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$rtd_assets\.$#'+ identifier: property.notFound+ count: 2+ path: app/Helpers/Helper.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$users\.$#'+ identifier: property.notFound+ count: 3+ path: app/Helpers/Helper.php+-message: '#^Call to function array_change_key_case\(\) on a separate line has no effect\.$#'identifier: function.resultUnused@@ -864,6 +1032,12 @@ parameters:count: 1path: app/Http/Controllers/Accessories/AccessoryCheckoutController.php+ -+ message: '#^Method App\\Http\\Controllers\\Accessories\\AccessoryCheckoutController\:\:determineCheckoutTarget\(\) should return App\\Models\\SnipeModel\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\.$#'+ identifier: return.type+ count: 1+ path: app/Http/Controllers/Accessories/AccessoryCheckoutController.php+-message: '#^PHPDoc tag @param for parameter \$request with type Illuminate\\Http\\Request is not subtype of native type App\\Http\\Requests\\AccessoryCheckoutRequest\.$#'identifier: parameter.phpDocType@@ -954,6 +1128,12 @@ parameters:count: 1path: app/Http/Controllers/Api/AccessoriesController.php+ -+ message: '#^Method App\\Http\\Controllers\\Api\\AccessoriesController\:\:determineCheckoutTarget\(\) should return App\\Models\\SnipeModel\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\.$#'+ identifier: return.type+ count: 1+ path: app/Http/Controllers/Api/AccessoriesController.php+-message: '#^PHPDoc tag @param for parameter \$request with type App\\Http\\Requests\\ImageUploadRequest is not subtype of native type App\\Http\\Requests\\StoreAccessoryRequest\.$#'identifier: parameter.phpDocType@@ -1038,6 +1218,12 @@ parameters:count: 1path: app/Http/Controllers/Api/AssetsController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/AssetsController.php+-message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:availableForCheckout\(\)\.$#'identifier: method.notFound@@ -1086,6 +1272,12 @@ parameters:count: 1path: app/Http/Controllers/Api/AssetsController.php+ -+ message: '#^Method App\\Http\\Controllers\\Api\\AssetsController\:\:resolveCheckoutTargetForAssetMutation\(\) should return App\\Models\\Asset\|App\\Models\\Location\|App\\Models\\User\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\|null\.$#'+ identifier: return.type+ count: 1+ path: app/Http/Controllers/Api/AssetsController.php+-message: '#^Method App\\Http\\Transformers\\AssetsTransformer\:\:transformAsset\(\) invoked with 2 parameters, 1 required\.$#'identifier: arguments.count@@ -1129,11 +1321,29 @@ parameters:path: app/Http/Controllers/Api/CategoriesController.php-- message: '#^Access to an undefined property App\\Models\\Category\:\:\$use_image\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$category_type\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/CategoriesController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$image\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/CategoriesController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$use_image\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/CategoriesController.php+ -+ message: '#^Call to an undefined method App\\Models\\Builders\\CategoryQueryBuilder\:\:TextSearch\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/CategoriesController.php+-message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:getErrors\(\)\.$#'identifier: method.notFound@@ -1387,23 +1597,47 @@ parameters:path: app/Http/Controllers/Api/CustomFieldsetsController.php-- message: '#^Access to an undefined property App\\Models\\Department\:\:\$use_image\.$#'+ message: '#^Access to an undefined property App\\Models\\SnipeModel\:\:\$created_by\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/DepartmentsController.php-- message: '#^Access to an undefined property App\\Models\\SnipeModel\:\:\$created_by\.$#'+ message: '#^Access to an undefined property App\\Models\\SnipeModel\:\:\$manager_id\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/DepartmentsController.php-- message: '#^Access to an undefined property App\\Models\\SnipeModel\:\:\$manager_id\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$users\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/DepartmentsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/DepartmentsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$image\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/DepartmentsController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$use_image\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/DepartmentsController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\DepartmentQueryBuilder\:\:TextSearch\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/DepartmentsController.php+-message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:getErrors\(\)\.$#'identifier: method.notFound@@ -1428,6 +1662,48 @@ parameters:count: 1path: app/Http/Controllers/Api/DepartmentsController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$models_count\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/DepreciationsController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\DepreciationQueryBuilder\:\:TextSearch\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/DepreciationsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/DepreciationsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$permissions\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/GroupsController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\GroupQueryBuilder\:\:TextSearch\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/GroupsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/GroupsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:isDeletable\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/GroupsController.php+-message: '#^Access to an undefined property App\\Models\\Import\:\:\$created_by\.$#'identifier: property.notFound@@ -1489,57 +1765,87 @@ parameters:path: app/Http/Controllers/Api/LicensesController.php-- message: '#^Access to an undefined property App\\Models\\Location\:\:\$use_text\.$#'+ message: '#^Access to an undefined property App\\Models\\SnipeModel\:\:\$company_id\.$#'identifier: property.notFound- count: 1+ count: 5path: app/Http/Controllers/Api/LocationsController.php-- message: '#^Access to an undefined property App\\Models\\SnipeModel\:\:\$company_id\.$#'+ message: '#^Access to an undefined property App\\Models\\SnipeModel\:\:\$parent_id\.$#'identifier: property.notFound- count: 5+ count: 2path: app/Http/Controllers/Api/LocationsController.php-- message: '#^Access to an undefined property App\\Models\\SnipeModel\:\:\$parent_id\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFoundcount: 2path: app/Http/Controllers/Api/LocationsController.php-- message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:getErrors\(\)\.$#'- identifier: method.notFound+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFoundcount: 2path: app/Http/Controllers/Api/LocationsController.php-- message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:isValid\(\)\.$#'- identifier: method.notFound+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/LocationsController.php-- message: '#^Method App\\Http\\Transformers\\AssetsTransformer\:\:transformAssets\(\) invoked with 3 parameters, 2 required\.$#'- identifier: arguments.count- count: 2+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$parent_id\.$#'+ identifier: property.notFound+ count: 1path: app/Http/Controllers/Api/LocationsController.php-- message: '#^PHPDoc tag @return with type Illuminate\\Http\\Response is incompatible with native type array\|Illuminate\\Http\\JsonResponse\.$#'- identifier: return.phpDocType+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$use_text\.$#'+ identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/LocationsController.php-- message: '#^Using nullsafe property access "\?\-\>name" on left side of \?\? is unnecessary\. Use \-\> instead\.$#'- identifier: nullsafe.neverNull- count: 4+ message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 2path: app/Http/Controllers/Api/LocationsController.php-- message: '#^Access to an undefined property App\\Models\\Actionlog\:\:\$created_by\.$#'- identifier: property.notFound- count: 3+ message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:isValid\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/LocationsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:isDeletable\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/LocationsController.php++ -+ message: '#^Method App\\Http\\Transformers\\AssetsTransformer\:\:transformAssets\(\) invoked with 3 parameters, 2 required\.$#'+ identifier: arguments.count+ count: 2+ path: app/Http/Controllers/Api/LocationsController.php++ -+ message: '#^PHPDoc tag @return with type Illuminate\\Http\\Response is incompatible with native type array\|Illuminate\\Http\\JsonResponse\.$#'+ identifier: return.phpDocType+ count: 1+ path: app/Http/Controllers/Api/LocationsController.php++ -+ message: '#^Using nullsafe property access "\?\-\>name" on left side of \?\? is unnecessary\. Use \-\> instead\.$#'+ identifier: nullsafe.neverNull+ count: 4+ path: app/Http/Controllers/Api/LocationsController.php++ -+ message: '#^Access to an undefined property App\\Models\\Actionlog\:\:\$created_by\.$#'+ identifier: property.notFound+ count: 3path: app/Http/Controllers/Api/MaintenancesController.php-@@ -1597,17 +1903,41 @@ parameters:path: app/Http/Controllers/Api/ManufacturersController.php-- message: '#^Access to an undefined property App\\Models\\Manufacturer\:\:\$use_image\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$image\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/ManufacturersController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/ManufacturersController.php-- message: '#^Access to an undefined property App\\Models\\Manufacturer\:\:\$use_text\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$use_image\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/ManufacturersController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$use_text\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/ManufacturersController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\ManufacturerQueryBuilder\:\:TextSearch\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/ManufacturersController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\ManufacturerQueryBuilder\:\:onlyTrashed\(\)\.$#'+ identifier: method.notFound+ count: 2+ path: app/Http/Controllers/Api/ManufacturersController.php+-message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:getErrors\(\)\.$#'identifier: method.notFound@@ -1645,23 +1975,83 @@ parameters:path: app/Http/Controllers/Api/NotesController.php-- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$licenses\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$accessories\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$consumables\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$models\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\PredefinedKitQueryBuilder\<App\\Models\\PredefinedKit\>\:\:TextSearch\(\)\.$#'identifier: method.notFound- count: 4+ count: 1path: app/Http/Controllers/Api/PredefinedKitsController.php-- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:detach\(\)\.$#'+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:consumables\(\)\.$#'identifier: method.notFound- count: 8+ count: 1path: app/Http/Controllers/Api/PredefinedKitsController.php-- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:syncWithoutDetaching\(\)\.$#'+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:licenses\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:models\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:accessories\(\)\.$#'identifier: method.notFoundcount: 4path: app/Http/Controllers/Api/PredefinedKitsController.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:consumables\(\)\.$#'+ identifier: method.notFound+ count: 3+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:licenses\(\)\.$#'+ identifier: method.notFound+ count: 3+ path: app/Http/Controllers/Api/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:models\(\)\.$#'+ identifier: method.notFound+ count: 3+ path: app/Http/Controllers/Api/PredefinedKitsController.php+-message: '#^PHPDoc tag @param references unknown parameter\: \$id$#'identifier: parameter.notFound@@ -1719,15 +2109,87 @@ parameters:-message: '#^Access to an undefined property App\\Models\\Statuslabel\:\:\$color\.$#'identifier: property.notFound- count: 3+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$archived\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$assets_count\.$#'+ identifier: property.notFound+ count: 1path: app/Http/Controllers/Api/StatuslabelsController.php-- message: '#^Access to an undefined property Illuminate\\Pagination\\LengthAwarePaginator\<int, App\\Models\\Statuslabel\>\:\:\$use_text\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$color\.$#'+ identifier: property.notFound+ count: 2+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$default_label\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/StatuslabelsController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$deployable\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 5+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$pending\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$show_in_nav\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Pagination\\LengthAwarePaginator\<int, Illuminate\\Database\\Eloquent\\Model\>\:\:\$use_text\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\StatuslabelQueryBuilder\<App\\Models\\Statuslabel\>\:\:TextSearch\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:getStatuslabelType\(\)\.$#'+ identifier: method.notFound+ count: 2+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:assets\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/StatuslabelsController.php+-message: '#^Offset ''archived'' does not exist on string\.$#'identifier: offsetAccess.notFound@@ -1771,17 +2233,35 @@ parameters:path: app/Http/Controllers/Api/SuppliersController.php-- message: '#^Access to an undefined property App\\Models\\Supplier\:\:\$use_image\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$image\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/SuppliersController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/SuppliersController.php-- message: '#^Access to an undefined property App\\Models\\Supplier\:\:\$use_text\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$use_image\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/Api/SuppliersController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$use_text\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Api/SuppliersController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\SupplierQueryBuilder\:\:TextSearch\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Api/SuppliersController.php+-message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:getErrors\(\)\.$#'identifier: method.notFound@@ -1962,6 +2442,12 @@ parameters:count: 1path: app/Http/Controllers/AssetModelsController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Assets/AssetCheckinController.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:disassociate\(\)\.$#'identifier: method.notFound@@ -1998,6 +2484,12 @@ parameters:count: 3path: app/Http/Controllers/Assets/AssetCheckoutController.php+ -+ message: '#^Method App\\Http\\Controllers\\Assets\\AssetCheckoutController\:\:determineCheckoutTarget\(\) should return App\\Models\\SnipeModel\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\.$#'+ identifier: return.type+ count: 1+ path: app/Http/Controllers/Assets/AssetCheckoutController.php+-message: '#^PHPDoc tag @param references unknown parameter\: \$assetId$#'identifier: parameter.notFound@@ -2022,6 +2514,12 @@ parameters:count: 2path: app/Http/Controllers/Assets/AssetsController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/Assets/AssetsController.php+-message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:checkOut\(\)\.$#'identifier: method.notFound@@ -2046,6 +2544,12 @@ parameters:count: 1path: app/Http/Controllers/Assets/AssetsController.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:getStatuslabelType\(\)\.$#'+ identifier: method.notFound+ count: 3+ path: app/Http/Controllers/Assets/AssetsController.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:AssetsForShow\(\)\.$#'identifier: method.notFound@@ -2143,20 +2647,32 @@ parameters:path: app/Http/Controllers/Assets/BulkAssetsController.php-- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:disassociate\(\)\.$#'- identifier: method.notFound+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$deployable\.$#'+ identifier: property.notFoundcount: 1path: app/Http/Controllers/Assets/BulkAssetsController.php-- message: '#^Right side of \|\| is always false\.$#'- identifier: booleanOr.rightAlwaysFalse+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 3+ path: app/Http/Controllers/Assets/BulkAssetsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$pending\.$#'+ identifier: property.notFoundcount: 1path: app/Http/Controllers/Assets/BulkAssetsController.php-- message: '#^Strict comparison using \=\=\= between bool and 1 will always evaluate to false\.$#'- identifier: identical.alwaysFalse+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:disassociate\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Assets/BulkAssetsController.php++ -+ message: '#^Method App\\Http\\Controllers\\Assets\\BulkAssetsController\:\:determineCheckoutTarget\(\) should return App\\Models\\SnipeModel\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\.$#'+ identifier: return.typecount: 1path: app/Http/Controllers/Assets/BulkAssetsController.php@@ -2310,6 +2826,54 @@ parameters:count: 1path: app/Http/Controllers/Auth/SamlController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 6+ path: app/Http/Controllers/BulkCategoriesController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/BulkDepartmentsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 3+ path: app/Http/Controllers/BulkDepreciationsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/BulkLocationsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/BulkLocationsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 2+ path: app/Http/Controllers/BulkLocationsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$parent_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/BulkLocationsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:isDeletable\(\)\.$#'+ identifier: method.notFound+ count: 2+ path: app/Http/Controllers/BulkLocationsController.php+-message: '#^Access to an undefined property App\\Models\\Actionlog\:\:\$created_by\.$#'identifier: property.notFound@@ -2317,29 +2881,59 @@ parameters:path: app/Http/Controllers/BulkMaintenancesController.php-- message: '#^Access to an undefined property App\\Models\\Supplier\|Illuminate\\Database\\Eloquent\\Collection\<int, App\\Models\\Supplier\>\:\:\$accessories_count\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 5+ path: app/Http/Controllers/BulkManufacturersController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/BulkStatuslabelsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$accessories_count\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/BulkSuppliersController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$asset_maintenances_count\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/BulkSuppliersController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$assets_count\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/BulkSuppliersController.php-- message: '#^Access to an undefined property App\\Models\\Supplier\|Illuminate\\Database\\Eloquent\\Collection\<int, App\\Models\\Supplier\>\:\:\$asset_maintenances_count\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$components_count\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/BulkSuppliersController.php-- message: '#^Access to an undefined property App\\Models\\Supplier\|Illuminate\\Database\\Eloquent\\Collection\<int, App\\Models\\Supplier\>\:\:\$components_count\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$consumables_count\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/BulkSuppliersController.php-- message: '#^Access to an undefined property App\\Models\\Supplier\|Illuminate\\Database\\Eloquent\\Collection\<int, App\\Models\\Supplier\>\:\:\$consumables_count\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$licenses_count\.$#'identifier: property.notFoundcount: 1path: app/Http/Controllers/BulkSuppliersController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 6+ path: app/Http/Controllers/BulkSuppliersController.php+-message: '#^Access to an undefined property App\\Models\\Category\:\:\$created_by\.$#'identifier: property.notFound@@ -2640,6 +3234,12 @@ parameters:count: 2path: app/Http/Controllers/DepreciationsController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$models_count\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/DepreciationsController.php+-message: '#^PHPDoc tag @param references unknown parameter\: \$depreciationId$#'identifier: parameter.notFound@@ -2652,6 +3252,12 @@ parameters:count: 1path: app/Http/Controllers/GoogleAuthController.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:isDeletable\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/GroupsController.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:sync\(\)\.$#'identifier: method.notFound@@ -2676,6 +3282,12 @@ parameters:count: 1path: app/Http/Controllers/Kits/CheckoutKitController.php+ -+ message: '#^Method App\\Http\\Controllers\\Kits\\CheckoutKitController\:\:determineCheckoutTarget\(\) should return App\\Models\\SnipeModel\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\.$#'+ identifier: return.type+ count: 1+ path: app/Http/Controllers/Kits/CheckoutKitController.php+-message: '#^Access to an undefined property App\\Models\\PredefinedKit\:\:\$created_by\.$#'identifier: property.notFound@@ -2683,21 +3295,69 @@ parameters:path: app/Http/Controllers/Kits/PredefinedKitsController.php-- message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$pivot\.$#'- identifier: property.notFound+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:accessories\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Kits/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:consumables\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Kits/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:makeModelRules\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Kits/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:models\(\)\.$#'+ identifier: method.notFoundcount: 2path: app/Http/Controllers/Kits/PredefinedKitsController.php-- message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$pivot\.$#'- identifier: property.notFound- count: 6+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:accessories\(\)\.$#'+ identifier: method.notFound+ count: 3+ path: app/Http/Controllers/Kits/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:consumables\(\)\.$#'+ identifier: method.notFound+ count: 3+ path: app/Http/Controllers/Kits/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:licenses\(\)\.$#'+ identifier: method.notFound+ count: 4+ path: app/Http/Controllers/Kits/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:makeAccessoryRules\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Kits/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:makeConsumableRules\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/Kits/PredefinedKitsController.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:makeLicenseRules\(\)\.$#'+ identifier: method.notFound+ count: 1path: app/Http/Controllers/Kits/PredefinedKitsController.php-- message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:detach\(\)\.$#'+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:models\(\)\.$#'identifier: method.notFound- count: 8+ count: 2path: app/Http/Controllers/Kits/PredefinedKitsController.php-@@ -2850,12 +3510,48 @@ parameters:count: 1path: app/Http/Controllers/LocationsController.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$image\.$#'+ identifier: property.notFound+ count: 2+ path: app/Http/Controllers/LocationsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'+ identifier: property.notFound+ count: 2+ path: app/Http/Controllers/LocationsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Http/Controllers/LocationsController.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 2+ path: app/Http/Controllers/LocationsController.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\LocationQueryBuilder\<App\\Models\\Location\>\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/LocationsController.php+-message: '#^Call to an undefined method App\\Models\\SnipeModel\:\:getErrors\(\)\.$#'identifier: method.notFoundcount: 2path: app/Http/Controllers/LocationsController.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:isDeletable\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/LocationsController.php+-message: '#^PHPDoc tag @param references unknown parameter\: \$id$#'identifier: parameter.notFound@@ -2868,12 +3564,6 @@ parameters:count: 2path: app/Http/Controllers/LocationsController.php- -- message: '#^Property App\\Models\\Location\:\:\$id \(int\) does not accept null\.$#'- identifier: assign.propertyType- count: 1- path: app/Http/Controllers/LocationsController.php--message: '#^Using nullsafe property access "\?\-\>name" on left side of \?\? is unnecessary\. Use \-\> instead\.$#'identifier: nullsafe.neverNull@@ -3246,6 +3936,12 @@ parameters:count: 1path: app/Http/Controllers/StatuslabelsController.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:assets\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Controllers/StatuslabelsController.php+-message: '#^Offset ''archived'' does not exist on string\.$#'identifier: offsetAccess.notFound@@ -3540,6 +4236,24 @@ parameters:count: 1path: app/Http/Transformers/ActionlogsTransformer.php+ -+ message: '#^Call to an undefined method App\\Models\\Builders\\LocationQueryBuilder\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Transformers/ActionlogsTransformer.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\StatuslabelQueryBuilder\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Transformers/ActionlogsTransformer.php++ -+ message: '#^Call to an undefined method App\\Models\\Builders\\SupplierQueryBuilder\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Http/Transformers/ActionlogsTransformer.php+-message: '#^Expression on left side of \?\? is not nullable\.$#'identifier: nullCoalesce.expr@@ -3990,6 +4704,12 @@ parameters:count: 1path: app/Importer/AccessoryImporter.php+ -+ message: '#^Method App\\Importer\\AssetHistoryImporter\:\:resolveTargetLocation\(\) should return App\\Models\\Location\|null but returns Illuminate\\Database\\Eloquent\\Model\|null\.$#'+ identifier: return.type+ count: 1+ path: app/Importer/AssetHistoryImporter.php+-message: '#^Negated boolean expression is always false\.$#'identifier: booleanNot.alwaysFalse@@ -4014,6 +4734,12 @@ parameters:count: 1path: app/Importer/AssetImporter.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 3+ path: app/Importer/AssetImporter.php+-message: '#^Call to function is_null\(\) with string will always evaluate to false\.$#'identifier: function.impossibleType@@ -4033,7 +4759,7 @@ parameters:path: app/Importer/AssetImporter.php-- message: '#^Using nullsafe property access on non\-nullable type App\\Models\\Statuslabel\. Use \-\> instead\.$#'+ message: '#^Using nullsafe property access on non\-nullable type Illuminate\\Database\\Eloquent\\Model\. Use \-\> instead\.$#'identifier: nullsafe.neverNullcount: 1path: app/Importer/AssetImporter.php@@ -4044,6 +4770,12 @@ parameters:count: 1path: app/Importer/AssetModelImporter.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/AssetModelImporter.php+-message: '#^Access to an undefined property App\\Models\\Category\:\:\$created_by\.$#'identifier: property.notFound@@ -4051,11 +4783,23 @@ parameters:path: app/Importer/CategoryImporter.php-- message: '#^Access to an undefined property App\\Models\\Category\:\:\$errors\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$errors\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/CategoryImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'identifier: property.notFoundcount: 1path: app/Importer/CategoryImporter.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Importer/CategoryImporter.php+-message: '#^Access to an undefined property App\\Models\\Component\:\:\$created_by\.$#'identifier: property.notFound@@ -4098,6 +4842,12 @@ parameters:count: 2path: app/Importer/Importer.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/Importer.php+-message: '#^If condition is always true\.$#'identifier: if.alwaysTrue@@ -4224,6 +4974,24 @@ parameters:count: 1path: app/Importer/ItemImporter.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/ItemImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 5+ path: app/Importer/ItemImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/ItemImporter.php+-message: '#^Method App\\Importer\\ItemImporter\:\:createOrFetchAssetModel\(\) should return int but empty return statement found\.$#'identifier: return.empty@@ -4245,13 +5013,13 @@ parameters:-message: '#^Method App\\Importer\\ItemImporter\:\:createOrFetchLocation\(\) should return App\\Models\\Location\|null but returns int\.$#'identifier: return.type- count: 2+ count: 1path: app/Importer/ItemImporter.php-message: '#^Method App\\Importer\\ItemImporter\:\:createOrFetchManufacturer\(\) should return App\\Models\\Manufacturer but returns int\.$#'identifier: return.type- count: 2+ count: 1path: app/Importer/ItemImporter.php-@@ -4263,13 +5031,13 @@ parameters:-message: '#^Method App\\Importer\\ItemImporter\:\:createOrFetchStatusLabel\(\) should return App\\Models\\Statuslabel\|null but returns int\.$#'identifier: return.type- count: 2+ count: 1path: app/Importer/ItemImporter.php-message: '#^Method App\\Importer\\ItemImporter\:\:createOrFetchSupplier\(\) should return App\\Models\\Supplier but returns int\.$#'identifier: return.type- count: 2+ count: 1path: app/Importer/ItemImporter.php-@@ -4291,13 +5059,13 @@ parameters:path: app/Importer/ItemImporter.php-- message: '#^Method App\\Importer\\ItemImporter\:\:determineCheckout\(\) should return App\\Importer\\SnipeModel\|null but returns App\\Models\\Location\|Illuminate\\Database\\Eloquent\\Collection\<int, App\\Models\\Location\>\.$#'+ message: '#^Method App\\Importer\\ItemImporter\:\:determineCheckout\(\) should return App\\Importer\\SnipeModel\|null but returns App\\Models\\User\.$#'identifier: return.typecount: 2path: app/Importer/ItemImporter.php-- message: '#^Method App\\Importer\\ItemImporter\:\:determineCheckout\(\) should return App\\Importer\\SnipeModel\|null but returns App\\Models\\User\.$#'+ message: '#^Method App\\Importer\\ItemImporter\:\:determineCheckout\(\) should return App\\Importer\\SnipeModel\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\.$#'identifier: return.typecount: 2path: app/Importer/ItemImporter.php@@ -4363,11 +5131,23 @@ parameters:path: app/Importer/LocationImporter.php-- message: '#^Access to an undefined property App\\Models\\Location\:\:\$errors\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$errors\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/LocationImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'identifier: property.notFoundcount: 1path: app/Importer/LocationImporter.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Importer/LocationImporter.php+-message: '#^If condition is always true\.$#'identifier: if.alwaysTrue@@ -4381,11 +5161,23 @@ parameters:path: app/Importer/ManufacturerImporter.php-- message: '#^Access to an undefined property App\\Models\\Manufacturer\:\:\$errors\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$errors\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/ManufacturerImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'identifier: property.notFoundcount: 1path: app/Importer/ManufacturerImporter.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Importer/ManufacturerImporter.php+-message: '#^Access to an undefined property App\\Models\\Supplier\:\:\$created_by\.$#'identifier: property.notFound@@ -4393,11 +5185,41 @@ parameters:path: app/Importer/SupplierImporter.php-- message: '#^Access to an undefined property App\\Models\\Supplier\:\:\$errors\.$#'+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$errors\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/SupplierImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'identifier: property.notFoundcount: 1path: app/Importer/SupplierImporter.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getErrors\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Importer/SupplierImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$company\.$#'+ identifier: property.notFound+ count: 2+ path: app/Importer/UserImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 2+ path: app/Importer/UserImporter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Importer/UserImporter.php+-message: '#^Expression on left side of \?\? is not nullable\.$#'identifier: nullCoalesce.expr@@ -5088,6 +5910,12 @@ parameters:count: 6path: app/Models/Accessory.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Accessory.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -5166,6 +5994,12 @@ parameters:count: 1path: app/Models/Accessory.php+ -+ message: '#^Method App\\Models\\Accessory\:\:lastAcquisitionSupplier\(\) should return App\\Models\\Supplier\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\|null\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Accessory.php+-message: '#^Method App\\Models\\Accessory\:\:lastCheckout\(\) should return Illuminate\\Database\\Eloquent\\Relations\\HasMany but returns Illuminate\\Database\\Eloquent\\Relations\\Relation\.$#'identifier: return.type@@ -5310,6 +6144,12 @@ parameters:count: 2path: app/Models/Actionlog.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo\<App\\Models\\Location, \$this\(App\\Models\\Actionlog\)\>\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Models/Actionlog.php+-message: '#^Call to function is_array\(\) with string will always evaluate to false\.$#'identifier: function.impossibleType@@ -5406,6 +6246,12 @@ parameters:count: 1path: app/Models/Asset.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Asset.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -5520,6 +6366,12 @@ parameters:count: 1path: app/Models/Asset.php+ -+ message: '#^Method App\\Models\\Asset\:\:lastAcquisitionSupplier\(\) should return App\\Models\\Supplier\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\|null\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Asset.php+-message: '#^Method App\\Models\\Asset\:\:nextAutoIncrement\(\) should return int but return statement is missing\.$#'identifier: return.missing@@ -5784,6 +6636,12 @@ parameters:count: 1path: app/Models/AssetModel.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/AssetModel.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:fields\(\)\.$#'identifier: method.notFound@@ -5914,13 +6772,79 @@ parameters:message: '#^Using nullsafe property access "\?\-\>company_id" in isset\(\) is unnecessary\. Use \-\> instead\.$#'identifier: nullsafe.neverNullcount: 1- path: app/Models/AssetModel.php+ path: app/Models/AssetModel.php++ -+ message: '#^Using nullsafe property access "\?\-\>require_acceptance" on left side of \?\? is unnecessary\. Use \-\> instead\.$#'+ identifier: nullsafe.neverNull+ count: 1+ path: app/Models/AssetModel.php++ -+ message: '#^Method App\\Models\\Builders\\CategoryQueryBuilder\:\:orderByCreatedBy\(\) should return static\(App\\Models\\Builders\\CategoryQueryBuilder\) but returns App\\Models\\Builders\\CategoryQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/CategoryQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\DepartmentQueryBuilder\:\:orderByCreatedBy\(\) should return static\(App\\Models\\Builders\\DepartmentQueryBuilder\) but returns App\\Models\\Builders\\DepartmentQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/DepartmentQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\DepartmentQueryBuilder\:\:orderCompany\(\) should return static\(App\\Models\\Builders\\DepartmentQueryBuilder\) but returns App\\Models\\Builders\\DepartmentQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/DepartmentQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\DepartmentQueryBuilder\:\:orderLocation\(\) should return static\(App\\Models\\Builders\\DepartmentQueryBuilder\) but returns App\\Models\\Builders\\DepartmentQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/DepartmentQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\DepartmentQueryBuilder\:\:orderManager\(\) should return static\(App\\Models\\Builders\\DepartmentQueryBuilder\) but returns App\\Models\\Builders\\DepartmentQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/DepartmentQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\DepreciationQueryBuilder\:\:orderByCreatedBy\(\) should return static\(App\\Models\\Builders\\DepreciationQueryBuilder\) but returns App\\Models\\Builders\\DepreciationQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/DepreciationQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\GroupQueryBuilder\:\:orderByCreatedBy\(\) should return static\(App\\Models\\Builders\\GroupQueryBuilder\) but returns App\\Models\\Builders\\GroupQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/GroupQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\LocationQueryBuilder\:\:orderByCreatedByName\(\) should return static\(App\\Models\\Builders\\LocationQueryBuilder\) but returns App\\Models\\Builders\\LocationQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/LocationQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\LocationQueryBuilder\:\:orderCompany\(\) should return static\(App\\Models\\Builders\\LocationQueryBuilder\) but returns App\\Models\\Builders\\LocationQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/LocationQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\LocationQueryBuilder\:\:orderManager\(\) should return static\(App\\Models\\Builders\\LocationQueryBuilder\) but returns App\\Models\\Builders\\LocationQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/LocationQueryBuilder.php-- message: '#^Using nullsafe property access "\?\-\>require_acceptance" on left side of \?\? is unnecessary\. Use \-\> instead\.$#'- identifier: nullsafe.neverNull+ message: '#^Method App\\Models\\Builders\\LocationQueryBuilder\:\:orderParent\(\) should return static\(App\\Models\\Builders\\LocationQueryBuilder\) but returns App\\Models\\Builders\\LocationQueryBuilder\.$#'+ identifier: return.typecount: 1- path: app/Models/AssetModel.php+ path: app/Models/Builders/LocationQueryBuilder.php-message: '#^Method App\\Models\\Builders\\MaintenanceQueryBuilder\:\:active\(\) should return static\(App\\Models\\Builders\\MaintenanceQueryBuilder\) but returns App\\Models\\Builders\\MaintenanceQueryBuilder\.$#'@@ -6012,6 +6936,30 @@ parameters:count: 1path: app/Models/Builders/MaintenanceQueryBuilder.php+ -+ message: '#^Method App\\Models\\Builders\\ManufacturerQueryBuilder\:\:orderByCreatedBy\(\) should return static\(App\\Models\\Builders\\ManufacturerQueryBuilder\) but returns App\\Models\\Builders\\ManufacturerQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/ManufacturerQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\PredefinedKitQueryBuilder\:\:orderByCreatedBy\(\) should return static\(App\\Models\\Builders\\PredefinedKitQueryBuilder\) but returns App\\Models\\Builders\\PredefinedKitQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/PredefinedKitQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\StatuslabelQueryBuilder\:\:orderByCreatedBy\(\) should return static\(App\\Models\\Builders\\StatuslabelQueryBuilder\) but returns App\\Models\\Builders\\StatuslabelQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/StatuslabelQueryBuilder.php++ -+ message: '#^Method App\\Models\\Builders\\SupplierQueryBuilder\:\:orderByCreatedByName\(\) should return static\(App\\Models\\Builders\\SupplierQueryBuilder\) but returns App\\Models\\Builders\\SupplierQueryBuilder\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Builders/SupplierQueryBuilder.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -6036,6 +6984,12 @@ parameters:count: 1path: app/Models/Category.php+ -+ message: '#^PHPDoc tag @return with type Illuminate\\Database\\Query\\Builder is incompatible with native type App\\Models\\Builders\\CategoryQueryBuilder\.$#'+ identifier: return.phpDocType+ count: 1+ path: app/Models/Category.php+-message: '#^PHPDoc type array of property App\\Models\\Category\:\:\$fillable is not covariant with PHPDoc type list\<string\> of overridden property Illuminate\\Database\\Eloquent\\Model\:\:\$fillable\.$#'identifier: property.phpDocType@@ -6186,6 +7140,12 @@ parameters:count: 1path: app/Models/Company.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Company.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -6378,6 +7338,12 @@ parameters:count: 1path: app/Models/Component.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Component.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -6456,6 +7422,12 @@ parameters:count: 1path: app/Models/Component.php+ -+ message: '#^Method App\\Models\\Component\:\:lastAcquisitionSupplier\(\) should return App\\Models\\Supplier\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\|null\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Component.php+-message: '#^PHPDoc tag @SuppressWarnings has invalid value \(\(PHPMD\.UnusedFormalParameter\)\)\: Unexpected token "\.UnusedFormalParameter\)", expected ''\)'' at offset 351 on line 10$#'identifier: phpDoc.parseError@@ -6618,6 +7590,12 @@ parameters:count: 1path: app/Models/Consumable.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Consumable.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -6696,6 +7674,12 @@ parameters:count: 1path: app/Models/Consumable.php+ -+ message: '#^Method App\\Models\\Consumable\:\:lastAcquisitionSupplier\(\) should return App\\Models\\Supplier\|null but returns Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\|null\.$#'+ identifier: return.type+ count: 1+ path: app/Models/Consumable.php+-message: '#^PHPDoc tag @SuppressWarnings has invalid value \(\(PHPMD\.UnusedFormalParameter\)\)\: Unexpected token "\.UnusedFormalParameter\)", expected ''\)'' at offset 351 on line 10$#'identifier: phpDoc.parseError@@ -6858,6 +7842,12 @@ parameters:count: 1path: app/Models/Department.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Department.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -6888,24 +7878,6 @@ parameters:count: 1path: app/Models/Department.php- -- message: '#^Parameter \$order of method App\\Models\\Department\:\:scopeOrderCompany\(\) has invalid type App\\Models\\text\.$#'- identifier: class.notFound- count: 1- path: app/Models/Department.php-- -- message: '#^Parameter \$order of method App\\Models\\Department\:\:scopeOrderLocation\(\) has invalid type App\\Models\\text\.$#'- identifier: class.notFound- count: 1- path: app/Models/Department.php-- -- message: '#^Parameter \$order of method App\\Models\\Department\:\:scopeOrderManager\(\) has invalid type App\\Models\\text\.$#'- identifier: class.notFound- count: 1- path: app/Models/Department.php--message: '#^Property App\\Models\\Department\:\:\$searchableAttributes \(array\) on left side of \?\? is not nullable\.$#'identifier: nullCoalesce.property@@ -7452,6 +8424,12 @@ parameters:count: 1path: app/Models/Labels/Tapes/Generic/Tape_53mm.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 4+ path: app/Models/Ldap.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'identifier: method.notFound@@ -7512,12 +8490,30 @@ parameters:count: 1path: app/Models/License.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/License.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFoundcount: 2path: app/Models/License.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo\<App\\Models\\Category, \$this\(App\\Models\\License\)\>\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Models/License.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo\<App\\Models\\Manufacturer, \$this\(App\\Models\\License\)\>\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Models/License.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:withTrashed\(\)\.$#'identifier: method.notFound@@ -7638,6 +8634,12 @@ parameters:count: 1path: app/Models/LicenseSeat.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/LicenseSeat.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:withTrashed\(\)\.$#'identifier: method.notFound@@ -7746,6 +8748,12 @@ parameters:count: 1path: app/Models/Location.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Location.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -7758,24 +8766,12 @@ parameters:count: 1path: app/Models/Location.php- -- message: '#^Call to method leftJoin\(\) on an unknown class App\\Models\\Illuminate\\Database\\Query\\Builder\.$#'- identifier: class.notFound- count: 1- path: app/Models/Location.php--message: '#^Method App\\Models\\Location\:\:getLatestSignedAcceptance\(\) should return App\\Models\\Actionlog\|null but returns Illuminate\\Database\\Eloquent\\Model\|null\.$#'identifier: return.typecount: 1path: app/Models/Location.php- -- message: '#^Method App\\Models\\Location\:\:scopeOrderParent\(\) has invalid return type App\\Models\\Illuminate\\Database\\Query\\Builder\.$#'- identifier: class.notFound- count: 1- path: app/Models/Location.php--message: '#^PHPDoc tag @SuppressWarnings has invalid value \(\(PHPMD\.UnusedFormalParameter\)\)\: Unexpected token "\.UnusedFormalParameter\)", expected ''\)'' at offset 351 on line 10$#'identifier: phpDoc.parseError@@ -7788,30 +8784,6 @@ parameters:count: 1path: app/Models/Location.php- -- message: '#^Parameter \$order of method App\\Models\\Location\:\:scopeOrderCompany\(\) has invalid type App\\Models\\text\.$#'- identifier: class.notFound- count: 1- path: app/Models/Location.php-- -- message: '#^Parameter \$order of method App\\Models\\Location\:\:scopeOrderManager\(\) has invalid type App\\Models\\text\.$#'- identifier: class.notFound- count: 1- path: app/Models/Location.php-- -- message: '#^Parameter \$order of method App\\Models\\Location\:\:scopeOrderParent\(\) has invalid type App\\Models\\text\.$#'- identifier: class.notFound- count: 1- path: app/Models/Location.php-- -- message: '#^Parameter \$query of method App\\Models\\Location\:\:scopeOrderParent\(\) has invalid type App\\Models\\Illuminate\\Database\\Query\\Builder\.$#'- identifier: class.notFound- count: 1- path: app/Models/Location.php--message: '#^Property App\\Models\\Location\:\:\$searchableAttributes \(array\) on left side of \?\? is not nullable\.$#'identifier: nullCoalesce.property@@ -7872,6 +8844,18 @@ parameters:count: 1path: app/Models/Maintenance.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Maintenance.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo\<App\\Models\\Supplier, \$this\(App\\Models\\Maintenance\)\>\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Models/Maintenance.php+-message: '#^Call to function is_array\(\) with string will always evaluate to false\.$#'identifier: function.impossibleType@@ -8112,30 +9096,6 @@ parameters:count: 1path: app/Models/Statuslabel.php- -- message: '#^Method App\\Models\\Statuslabel\:\:scopeArchived\(\) should return Illuminate\\Database\\Query\\Builder but returns Illuminate\\Database\\Eloquent\\Builder\<App\\Models\\Statuslabel\>\.$#'- identifier: return.type- count: 1- path: app/Models/Statuslabel.php-- -- message: '#^Method App\\Models\\Statuslabel\:\:scopeDeployable\(\) should return Illuminate\\Database\\Query\\Builder but returns Illuminate\\Database\\Eloquent\\Builder\<App\\Models\\Statuslabel\>\.$#'- identifier: return.type- count: 1- path: app/Models/Statuslabel.php-- -- message: '#^Method App\\Models\\Statuslabel\:\:scopePending\(\) should return Illuminate\\Database\\Query\\Builder but returns Illuminate\\Database\\Eloquent\\Builder\<App\\Models\\Statuslabel\>\.$#'- identifier: return.type- count: 1- path: app/Models/Statuslabel.php-- -- message: '#^Method App\\Models\\Statuslabel\:\:scopeUndeployable\(\) should return Illuminate\\Database\\Query\\Builder but returns Illuminate\\Database\\Eloquent\\Builder\<App\\Models\\Statuslabel\>\.$#'- identifier: return.type- count: 1- path: app/Models/Statuslabel.php--message: '#^PHPDoc tag @SuppressWarnings has invalid value \(\(PHPMD\.UnusedFormalParameter\)\)\: Unexpected token "\.UnusedFormalParameter\)", expected ''\)'' at offset 351 on line 10$#'identifier: phpDoc.parseError@@ -8190,6 +9150,12 @@ parameters:count: 1path: app/Models/Supplier.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/Supplier.php+-message: '#^Call to function is_array\(\) with string will always evaluate to false\.$#'identifier: function.impossibleType@@ -8322,6 +9288,12 @@ parameters:count: 1path: app/Models/User.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Models/User.php+-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'identifier: property.notFound@@ -8337,7 +9309,13 @@ parameters:-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'identifier: property.notFound- count: 1+ count: 2+ path: app/Models/User.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo\<App\\Models\\Location, \$this\(App\\Models\\User\)\>\:\:withTrashed\(\)\.$#'+ identifier: method.notFound+ count: 2path: app/Models/User.php-@@ -9702,6 +10680,42 @@ parameters:count: 1path: app/Providers/EventServiceProvider.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$company\.$#'+ identifier: property.notFound+ count: 1+ path: app/Providers/ValidationServiceProvider.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Providers/ValidationServiceProvider.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company\.$#'+ identifier: property.notFound+ count: 1+ path: app/Providers/ValidationServiceProvider.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$company_id\.$#'+ identifier: property.notFound+ count: 1+ path: app/Providers/ValidationServiceProvider.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/Providers/ValidationServiceProvider.php++ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:effectiveFmcsCompanyId\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Providers/ValidationServiceProvider.php+-message: '#^Call to function is_array\(\) with mixed will always evaluate to false\.$#'identifier: function.impossibleType@@ -9714,6 +10728,12 @@ parameters:count: 5path: app/Providers/ValidationServiceProvider.php+ -+ message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:getStatuslabelType\(\)\.$#'+ identifier: method.notFound+ count: 1+ path: app/Rules/AssetCannotBeCheckedOutToNondeployableStatus.php+-message: '#^Access to an undefined property App\\Models\\AccessoryCheckout\:\:\$created_by\.$#'identifier: property.notFound@@ -9876,6 +10896,18 @@ parameters:count: 3path: app/SyncAdapters/SyncAdapter.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 3+ path: app/SyncAdapters/SyncAdapter.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 1+ path: app/SyncAdapters/SyncAdapter.php+-message: '#^Property App\\Models\\Asset\:\:\$purchase_date \(Carbon\\Carbon\|null\) does not accept string\.$#'identifier: assign.propertyType@@ -9969,7 +11001,7 @@ parameters:-message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'identifier: property.notFound- count: 2+ count: 5path: database/factories/ActionlogFactory.php-@@ -10380,6 +11412,12 @@ parameters:count: 1path: database/migrations/2024_09_17_204302_change_user_id_to_created_by.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 2+ path: database/seeders/AccessorySeeder.php+-message: '#^Using nullsafe method call on non\-nullable type Illuminate\\Console\\Command\. Use \-\> instead\.$#'identifier: nullsafe.neverNull@@ -10404,12 +11442,24 @@ parameters:count: 1path: database/seeders/AssetSeeder.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 1+ path: database/seeders/ComponentSeeder.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'identifier: method.notFoundcount: 1path: database/seeders/ComponentSeeder.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Collection\<int, Illuminate\\Database\\Eloquent\\Model\>\|Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 2+ path: database/seeders/ConsumableSeeder.php+-message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\Relation\:\:attach\(\)\.$#'identifier: method.notFound@@ -10434,6 +11484,18 @@ parameters:count: 2path: database/seeders/ImportSeeder.php+ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$id\.$#'+ identifier: property.notFound+ count: 4+ path: database/seeders/LicenseSeeder.php++ -+ message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$name\.$#'+ identifier: property.notFound+ count: 2+ path: database/seeders/LicenseSeeder.php+-message: '#^Access to an undefined property App\\Models\\User\:\:\$enable_sound\.$#'identifier: property.notFounddiff --git a/tests/Feature/Api/IndexSortRegressionTest.php b/tests/Feature/Api/IndexSortRegressionTest.phpnew file mode 100644index 0000000000..8a1a8ae785--- /dev/null+++ b/tests/Feature/Api/IndexSortRegressionTest.php@@ -0,0 +1,114 @@+<?php++namespace Tests\Feature\Api;++use App\Models\Accessory;+use App\Models\Asset;+use App\Models\AssetModel;+use App\Models\Category;+use App\Models\Component;+use App\Models\Consumable;+use App\Models\Department;+use App\Models\Depreciation;+use App\Models\Group;+use App\Models\License;+use App\Models\Location;+use App\Models\Manufacturer;+use App\Models\PredefinedKit;+use App\Models\Statuslabel;+use App\Models\Supplier;+use App\Models\User;+use PHPUnit\Framework\Attributes\DataProvider;+use Tests\TestCase;++/**+ * Covers every (endpoint, sort column) pair whose Order scope was+ * swapped from `->select('<table>.*')` to `->addSelect('<table>.*')`+ * so the `withCount` subqueries wouldn't be wiped by the sort join.+ * That change exposed a latent bug: index controllers that pre-call+ * `Model::select(['id', 'name', ...])` with UNQUALIFIED columns+ * started producing "Column 'id' is ambiguous" from MySQL as soon as+ * the sort's leftJoin brought in another table with an `id` column.+ *+ * Each case here hits the sort endpoint and asserts a 200 so a future+ * regression (unqualified select plus a new sort join, re-added+ * `select()` call clobbering the subquery, etc.) fails here first+ * instead of as a 500 on an admin's click.+ *+ * The withCount preservation that motivated the sweep in the first+ * place is verified structurally by the response.rows[0] key check+ * where it's exposed in the response, so the N+1 regression that+ * `addSelect` prevents also has a test teeth here.+ */+class IndexSortRegressionTest extends TestCase+{+ public static function sortCases(): array+ {+ return [+ 'accessories by created_by' => ['api.accessories.index', 'created_by'],+ 'categories by created_by' => ['api.categories.index', 'created_by'],+ 'components by created_by' => ['api.components.index', 'created_by'],+ 'consumables by created_by' => ['api.consumables.index', 'created_by'],+ 'departments by created_by' => ['api.departments.index', 'created_by'],+ 'departments by location' => ['api.departments.index', 'location'],+ 'departments by manager' => ['api.departments.index', 'manager'],+ 'departments by company' => ['api.departments.index', 'company'],+ 'depreciations by created_by' => ['api.depreciations.index', 'created_by'],+ 'groups by created_by' => ['api.groups.index', 'created_by'],+ 'hardware by created_by' => ['api.assets.index', 'created_by'],+ 'hardware by jobtitle' => ['api.assets.index', 'jobtitle'],+ 'hardware by assigned_to' => ['api.assets.index', 'assigned_to'],+ 'kits by created_by' => ['api.kits.index', 'created_by'],+ 'licenses by created_by' => ['api.licenses.index', 'created_by'],+ 'licenses by manufacturer' => ['api.licenses.index', 'manufacturer'],+ 'licenses by supplier' => ['api.licenses.index', 'supplier'],+ 'licenses by company' => ['api.licenses.index', 'company'],+ 'locations by created_by' => ['api.locations.index', 'created_by'],+ 'locations by parent' => ['api.locations.index', 'parent'],+ 'locations by manager' => ['api.locations.index', 'manager'],+ 'locations by company' => ['api.locations.index', 'company'],+ 'manufacturers by created_by' => ['api.manufacturers.index', 'created_by'],+ 'models by created_by' => ['api.models.index', 'created_by'],+ 'statuslabels by created_by' => ['api.statuslabels.index', 'created_by'],+ 'suppliers by created_by' => ['api.suppliers.index', 'created_by'],+ ];+ }++ #[DataProvider('sortCases')]+ public function test_sort_endpoint_returns_ok(string $routeName, string $sort): void+ {+ $this->seedOneRowFor($routeName);++ $this->actingAsForApi(User::factory()->superuser()->create())+ ->getJson(route($routeName, ['sort' => $sort, 'order' => 'desc']))+ ->assertOk();+ }++ /**+ * Each endpoint needs at least one row for the response.total check+ * to prove the sort actually traversed data. A superuser creator is+ * fine for every model under test. For License, the factory requires+ * a Category + Manufacturer so we build those up explicitly.+ */+ private function seedOneRowFor(string $routeName): void+ {+ match ($routeName) {+ 'api.accessories.index' => Accessory::factory()->create(),+ 'api.categories.index' => Category::factory()->forAssets()->create(),+ 'api.components.index' => Component::factory()->create(),+ 'api.consumables.index' => Consumable::factory()->create(),+ 'api.departments.index' => Department::factory()->create(),+ 'api.depreciations.index' => Depreciation::factory()->create(),+ 'api.groups.index' => Group::factory()->create(),+ 'api.assets.index' => Asset::factory()->create(),+ 'api.kits.index' => PredefinedKit::factory()->create(),+ 'api.licenses.index' => License::factory()->create(),+ 'api.locations.index' => Location::factory()->create(),+ 'api.manufacturers.index' => Manufacturer::factory()->create(),+ 'api.models.index' => AssetModel::factory()->create(),+ 'api.statuslabels.index' => Statuslabel::factory()->create(),+ 'api.suppliers.index' => Supplier::factory()->create(),+ default => null,+ };+ }+}