mirror of
https://github.com/grokability/snipe-it.git
synced 2026-03-12 17:52:00 +08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Traits\Acceptable;
|
||||
use App\Models\Traits\CompanyableTrait;
|
||||
use App\Models\Traits\HasUploads;
|
||||
@@ -21,21 +20,23 @@ use Watson\Validating\ValidatingTrait;
|
||||
*/
|
||||
class Accessory extends SnipeModel
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $presenter = \App\Presenters\AccessoryPresenter::class;
|
||||
use Acceptable;
|
||||
use CompanyableTrait;
|
||||
use HasFactory;
|
||||
use HasUploads;
|
||||
use Loggable, Presentable;
|
||||
use Loggable;
|
||||
use Presentable;
|
||||
use Searchable;
|
||||
use SoftDeletes;
|
||||
use ValidatingTrait;
|
||||
|
||||
protected $table = 'accessories';
|
||||
protected $casts = [
|
||||
'purchase_date' => 'datetime',
|
||||
'requestable' => 'boolean', ];
|
||||
|
||||
use Searchable;
|
||||
use Acceptable;
|
||||
protected $presenter = \App\Presenters\AccessoryPresenter::class;
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that should be included when searching the model.
|
||||
@@ -80,7 +81,7 @@ class Accessory extends SnipeModel
|
||||
* @var bool
|
||||
*/
|
||||
protected $injectUniqueIdentifier = true;
|
||||
use ValidatingTrait;
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
||||
@@ -15,14 +15,18 @@ use Watson\Validating\ValidatingTrait;
|
||||
|
||||
class Location extends SnipeModel
|
||||
{
|
||||
use HasFactory;
|
||||
use CompanyableTrait;
|
||||
use HasFactory;
|
||||
use HasUploads;
|
||||
use Loggable;
|
||||
use Presentable;
|
||||
use Searchable;
|
||||
use SoftDeletes;
|
||||
use UniqueUndeletedTrait;
|
||||
use ValidatingTrait;
|
||||
|
||||
|
||||
protected $presenter = \App\Presenters\LocationPresenter::class;
|
||||
use Presentable;
|
||||
use SoftDeletes;
|
||||
use HasUploads;
|
||||
|
||||
protected $table = 'locations';
|
||||
protected $rules = [
|
||||
@@ -53,8 +57,7 @@ class Location extends SnipeModel
|
||||
* @var bool
|
||||
*/
|
||||
protected $injectUniqueIdentifier = true;
|
||||
use ValidatingTrait;
|
||||
use UniqueUndeletedTrait;
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
@@ -80,16 +83,28 @@ class Location extends SnipeModel
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
protected $hidden = ['user_id'];
|
||||
|
||||
use Searchable;
|
||||
|
||||
/**
|
||||
* The attributes that should be included when searching the model.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchableAttributes = ['name', 'address', 'city', 'state', 'zip', 'created_at', 'ldap_ou', 'phone', 'fax', 'notes'];
|
||||
protected $searchableAttributes =
|
||||
[
|
||||
'name',
|
||||
'address',
|
||||
'city',
|
||||
'state',
|
||||
'zip',
|
||||
'created_at',
|
||||
'ldap_ou',
|
||||
'phone',
|
||||
'fax',
|
||||
'notes'
|
||||
];
|
||||
|
||||
/**
|
||||
* The relations and their attributes that should be included when searching the model.
|
||||
@@ -114,7 +129,6 @@ class Location extends SnipeModel
|
||||
*/
|
||||
public function isDeletable()
|
||||
{
|
||||
|
||||
return Gate::allows('delete', $this)
|
||||
&& ($this->deleted_at == '')
|
||||
&& (($this->assets_count ?? $this->assets()->count()) === 0)
|
||||
|
||||
@@ -20,7 +20,7 @@ trait CompanyableTrait
|
||||
if (__CLASS__ != 'App\Models\Location') {
|
||||
static::addGlobalScope(new CompanyableScope);
|
||||
} else {
|
||||
if (Setting::getSettings()->scope_locations_fmcs == 1) {
|
||||
if (Setting::getSettings()?->scope_locations_fmcs == 1) {
|
||||
static::addGlobalScope(new CompanyableScope);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
Component::observe(ComponentObserver::class);
|
||||
Consumable::observe(ConsumableObserver::class);
|
||||
License::observe(LicenseObserver::class);
|
||||
// Location::observe(LocationObserver::class);
|
||||
Location::observe(LocationObserver::class);
|
||||
Maintenance::observe(MaintenanceObserver::class);
|
||||
Setting::observe(SettingObserver::class);
|
||||
User::observe(UserObserver::class);
|
||||
|
||||
Reference in New Issue
Block a user