Skip to content

A free open source IT asset/license management system

Removed broken(?) use statement

snipe4545cf8989dc
diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php
index 23593af53c..902054fd21 100755
--- a/app/Models/Accessory.php
+++ b/app/Models/Accessory.php
@@ -2,7 +2,6 @@
namespace App\Models;
-use App\Http\Controllers\Api\AccessoriesController\checkedout;
use App\Models\Traits\Acceptable;
use App\Models\Traits\CompanyableTrait;
use App\Models\Traits\HasUploads;
@@ -47,7 +46,14 @@ class Accessory extends SnipeModel
*
* @var array
*/
- protected $searchableAttributes = ['name', 'model_number', 'order_number', 'purchase_date', 'notes'];
+ protected $searchableAttributes = [
+ 'model_number',
+ 'name',
+ 'notes',
+ 'order_number',
+ 'purchase_cost',
+ 'purchase_date',
+ ];
/**
* The relations and their attributes that should be included when searching the model.
@@ -57,9 +63,9 @@ class Accessory extends SnipeModel
protected $searchableRelations = [
'category' => ['name'],
'company' => ['name'],
+ 'location' => ['name'],
'manufacturer' => ['name'],
'supplier' => ['name'],
- 'location' => ['name'],
];
/**
@@ -295,20 +301,6 @@ class Accessory extends SnipeModel
->with('assignedTo');
}
- /**
- * Establishes the accessory -> admin user relationship
- *
- * @author A. Gianotto <[email protected]>
- *
- * @since [v7.0.13]
- *
- * @return Relation
- */
- public function adminuser()
- {
- return $this->belongsTo(User::class, 'created_by')->withTrashed();
- }
-
/**
* Checks whether or not the accessory has users
*
@@ -456,84 +448,6 @@ class Accessory extends SnipeModel
* BEGIN QUERY SCOPES
* -----------------------------------------------
**/
- /**
- * Query builder scope to search on text filters for complex Bootstrap Tables API
- *
- * @param Builder $query Query builder instance
- * @param text $filter JSON array of search keys and terms
- * @return Builder Modified query builder
- */
- public function scopeByFilter($query, $filter)
- {
- return $query->where(
- function ($query) use ($filter) {
- foreach ($filter as $fieldname => $search_val) {
-
- if ($fieldname == 'name') {
- $query->where('accessories.name', 'LIKE', '%'.$search_val.'%');
- }
-
- if ($fieldname == 'notes') {
- $query->where('accessories.notes', 'LIKE', '%'.$search_val.'%');
- }
-
- if ($fieldname == 'model_number') {
- $query->where('accessories.model_number', 'LIKE', '%'.$search_val.'%');
- }
-
- if ($fieldname == 'order_number') {
- $query->where('accessories.order_number', 'LIKE', '%'.$search_val.'%');
- }
-
- if ($fieldname == 'purchase_cost') {
- $query->where('accessories.purchase_cost', 'LIKE', '%'.$search_val.'%');
- }
-
- if ($fieldname == 'location') {
- $query->whereHas(
- 'location', function ($query) use ($search_val) {
- $query->where('locations.name', 'LIKE', '%'.$search_val.'%');
- }
- );
- }
-
- if ($fieldname == 'manufacturer') {
- $query->whereHas(
- 'manufacturer', function ($query) use ($search_val) {
- $query->where('manufacturers.name', 'LIKE', '%'.$search_val.'%');
- }
- );
- }
-
- if ($fieldname == 'supplier') {
- $query->whereHas(
- 'supplier', function ($query) use ($search_val) {
- $query->where('suppliers.name', 'LIKE', '%'.$search_val.'%');
- }
- );
- }
-
- if ($fieldname == 'category') {
- $query->whereHas(
- 'category', function ($query) use ($search_val) {
- $query->where('categories.name', 'LIKE', '%'.$search_val.'%');
- }
- );
- }
-
- if ($fieldname == 'company') {
- $query->whereHas(
- 'company', function ($query) use ($search_val) {
- $query->where('companies.name', 'LIKE', '%'.$search_val.'%');
- }
- );
- }
-
- }
-
- }
- );
- }
/**
* Query builder scope to order on created_by name