Convert deprecated $dates property to $casts

This commit is contained in:
Laravel Shift 2021-06-10 20:17:18 +00:00
parent bdf23e472e
commit 9f43ce97e9
17 changed files with 31 additions and 47 deletions

View file

@ -21,11 +21,10 @@ class Accessory extends SnipeModel
use Loggable, Presentable;
use SoftDeletes;
protected $dates = ['deleted_at', 'purchase_date'];
protected $table = 'accessories';
protected $casts = [
'requestable' => 'boolean',
];
'purchase_date' => 'datetime',
'requestable' => 'boolean', ];
use Searchable;
use Acceptable;

View file

@ -19,7 +19,7 @@ class Actionlog extends SnipeModel
protected $presenter = \App\Presenters\ActionlogPresenter::class;
use SoftDeletes;
use Presentable;
protected $dates = ['deleted_at'];
protected $table = 'action_logs';
public $timestamps = true;

View file

@ -66,18 +66,14 @@ class Asset extends Depreciable
protected $injectUniqueIdentifier = true;
// We set these as protected dates so that they will be easily accessible via Carbon
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
'purchase_date',
'last_checkout',
'expected_checkin',
'last_audit_date',
'next_audit_date',
];
protected $casts = [
'purchase_date' => 'datetime',
'last_checkout' => 'datetime',
'expected_checkin' => 'datetime',
'last_audit_date' => 'datetime',
'next_audit_date' => 'datetime',
'model_id' => 'integer',
'status_id' => 'integer',
'company_id' => 'integer',

View file

@ -18,8 +18,10 @@ class AssetMaintenance extends Model implements ICompanyableChild
use SoftDeletes;
use CompanyableChildTrait;
use ValidatingTrait;
protected $dates = ['deleted_at', 'start_date', 'completion_date'];
protected $casts = [
'start_date' => 'datetime',
'completion_date' => 'datetime',
];
protected $table = 'asset_maintenances';
protected $rules = [
'asset_id' => 'required|integer',

View file

@ -19,7 +19,7 @@ class AssetModel extends SnipeModel
use SoftDeletes;
protected $presenter = \App\Presenters\AssetModelPresenter::class;
use Requestable, Presentable;
protected $dates = ['deleted_at'];
protected $table = 'models';
protected $hidden = ['user_id', 'deleted_at'];

View file

@ -22,7 +22,7 @@ class Category extends SnipeModel
protected $presenter = \App\Presenters\CategoryPresenter::class;
use Presentable;
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $table = 'categories';
protected $hidden = ['user_id', 'deleted_at'];

View file

@ -10,15 +10,9 @@ class CheckoutAcceptance extends Model
{
use SoftDeletes;
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'accepted_at',
'declined_at',
'deleted_at',
protected $casts = [
'accepted_at' => 'datetime',
'declined_at' => 'datetime',
];
/**

View file

@ -18,8 +18,9 @@ class Component extends SnipeModel
use CompanyableTrait;
use Loggable, Presentable;
use SoftDeletes;
protected $dates = ['deleted_at', 'purchase_date'];
protected $casts = [
'purchase_date' => 'datetime',
];
protected $table = 'components';
/**

View file

@ -17,15 +17,14 @@ class Consumable extends SnipeModel
use SoftDeletes;
use Acceptable;
protected $dates = ['deleted_at', 'purchase_date'];
protected $table = 'consumables';
protected $casts = [
'purchase_date' => 'datetime',
'requestable' => 'boolean',
'category_id' => 'integer',
'company_id' => 'integer',
'qty' => 'integer',
'min_amt' => 'integer',
];
'min_amt' => 'integer', ];
/**
* Category validation rules

View file

@ -8,7 +8,6 @@ class ConsumableAssignment extends Model
{
use CompanyableTrait;
protected $dates = ['deleted_at'];
protected $table = 'consumables_users';
public function consumable()

View file

@ -22,14 +22,7 @@ class License extends Depreciable
use ValidatingTrait;
// We set these as protected dates so that they will be easily accessible via Carbon
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
'purchase_date',
'expiration_date',
'termination_date',
];
public $timestamps = true;
@ -37,6 +30,9 @@ class License extends Depreciable
protected $table = 'licenses';
protected $casts = [
'purchase_date' => 'datetime',
'expiration_date' => 'datetime',
'termination_date' => 'datetime',
'seats' => 'integer',
'category_id' => 'integer',
'company_id' => 'integer',

View file

@ -17,7 +17,6 @@ class LicenseSeat extends SnipeModel implements ICompanyableChild
protected $presenter = \App\Presenters\LicenseSeatPresenter::class;
use Presentable;
protected $dates = ['deleted_at'];
protected $guarded = 'id';
protected $table = 'license_seats';

View file

@ -19,7 +19,7 @@ class Location extends SnipeModel
protected $presenter = \App\Presenters\LocationPresenter::class;
use Presentable;
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $table = 'locations';
protected $rules = [
'name' => 'required|min:2|max:255|unique_undeleted',

View file

@ -13,7 +13,7 @@ class Manufacturer extends SnipeModel
protected $presenter = \App\Presenters\ManufacturerPresenter::class;
use Presentable;
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $table = 'manufacturers';
// Declare the rules for the form validation

View file

@ -14,7 +14,7 @@ class Statuslabel extends SnipeModel
use UniqueUndeletedTrait;
protected $injectUniqueIdentifier = true;
protected $dates = ['deleted_at'];
protected $table = 'status_labels';
protected $hidden = ['user_id', 'deleted_at'];

View file

@ -10,7 +10,7 @@ use Watson\Validating\ValidatingTrait;
class Supplier extends SnipeModel
{
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $table = 'suppliers';
protected $rules = [

View file

@ -29,7 +29,6 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
use Presentable;
use Searchable;
protected $dates = ['deleted_at'];
protected $hidden = ['password', 'remember_token', 'permissions', 'reset_password_code', 'persist_code'];
protected $table = 'users';
protected $injectUniqueIdentifier = true;