Merge pull request #12765 from spencerrlongg/chore/sc-20230

Change protected $dates to casts
This commit is contained in:
snipe 2023-04-04 01:29:24 -07:00 committed by GitHub
commit ead5293ee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 23 deletions

View file

@ -70,19 +70,6 @@ class Asset extends Depreciable
*/ */
protected $injectUniqueIdentifier = true; 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 = [ protected $casts = [
'purchase_date' => 'date', 'purchase_date' => 'date',
'last_checkout' => 'datetime', 'last_checkout' => 'datetime',
@ -96,6 +83,9 @@ class Asset extends Depreciable
'rtd_company_id' => 'integer', 'rtd_company_id' => 'integer',
'supplier_id' => 'integer', 'supplier_id' => 'integer',
'byod' => 'boolean', 'byod' => 'boolean',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
]; ];
protected $rules = [ protected $rules = [

View file

@ -73,18 +73,13 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
'location_id' => 'integer', 'location_id' => 'integer',
'company_id' => 'integer', 'company_id' => 'integer',
'vip' => 'boolean', 'vip' => 'boolean',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'start_date' => 'datetime:Y-m-d',
'end_date' => 'datetime:Y-m-d',
]; ];
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
'start_date' => 'date_format:Y-m-d',
'end_date' => 'date_format:Y-m-d',
];
/** /**
* Model validation rules * Model validation rules
* *