diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php index c2e5399d29..b32822cd82 100755 --- a/app/Models/Accessory.php +++ b/app/Models/Accessory.php @@ -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; diff --git a/app/Models/Actionlog.php b/app/Models/Actionlog.php index 3ac8c5cc7c..b42cfb5a00 100755 --- a/app/Models/Actionlog.php +++ b/app/Models/Actionlog.php @@ -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; diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 999c6711cb..f193798fee 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -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', diff --git a/app/Models/AssetMaintenance.php b/app/Models/AssetMaintenance.php index d501f42361..cd4bba1a28 100644 --- a/app/Models/AssetMaintenance.php +++ b/app/Models/AssetMaintenance.php @@ -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', diff --git a/app/Models/AssetModel.php b/app/Models/AssetModel.php index 377be0f9c8..df0f7a4d68 100755 --- a/app/Models/AssetModel.php +++ b/app/Models/AssetModel.php @@ -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']; diff --git a/app/Models/Category.php b/app/Models/Category.php index d19b013827..0bcd5fd100 100755 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -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']; diff --git a/app/Models/CheckoutAcceptance.php b/app/Models/CheckoutAcceptance.php index cb58093a47..cc6ca37fd4 100644 --- a/app/Models/CheckoutAcceptance.php +++ b/app/Models/CheckoutAcceptance.php @@ -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', ]; /** diff --git a/app/Models/Component.php b/app/Models/Component.php index 7c413ea965..f0af84fe71 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -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'; /** diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php index b8a75a5c57..26a146149b 100644 --- a/app/Models/Consumable.php +++ b/app/Models/Consumable.php @@ -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 diff --git a/app/Models/ConsumableAssignment.php b/app/Models/ConsumableAssignment.php index 4c5ef53a60..1e21a7f7d2 100644 --- a/app/Models/ConsumableAssignment.php +++ b/app/Models/ConsumableAssignment.php @@ -8,7 +8,6 @@ class ConsumableAssignment extends Model { use CompanyableTrait; - protected $dates = ['deleted_at']; protected $table = 'consumables_users'; public function consumable() diff --git a/app/Models/License.php b/app/Models/License.php index 119e364509..3476a141ef 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -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', diff --git a/app/Models/LicenseSeat.php b/app/Models/LicenseSeat.php index 5d3a21f4b6..2207edd02c 100755 --- a/app/Models/LicenseSeat.php +++ b/app/Models/LicenseSeat.php @@ -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'; diff --git a/app/Models/Location.php b/app/Models/Location.php index 4bb4c5f19a..080158a909 100755 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -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', diff --git a/app/Models/Manufacturer.php b/app/Models/Manufacturer.php index 5d12b1d786..0bd16f5bb3 100755 --- a/app/Models/Manufacturer.php +++ b/app/Models/Manufacturer.php @@ -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 diff --git a/app/Models/Statuslabel.php b/app/Models/Statuslabel.php index 17a277db7b..772e1ee92d 100755 --- a/app/Models/Statuslabel.php +++ b/app/Models/Statuslabel.php @@ -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']; diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index 0b38c01683..8752126b8d 100755 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -10,7 +10,7 @@ use Watson\Validating\ValidatingTrait; class Supplier extends SnipeModel { use SoftDeletes; - protected $dates = ['deleted_at']; + protected $table = 'suppliers'; protected $rules = [ diff --git a/app/Models/User.php b/app/Models/User.php index f9d4a4071f..f7ec2509cb 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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;