diff --git a/app/Models/User.php b/app/Models/User.php index 33501ba0..d7c072da 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -81,6 +81,8 @@ class User extends Authenticatable implements MustVerifyEmail protected $casts = [ 'email_verified_at' => 'datetime', 'last_seen' => 'datetime', + 'credits' => 'float', + 'server_limit' => 'float', ]; /** @@ -239,5 +241,4 @@ class User extends Authenticatable implements MustVerifyEmail $status = str_replace(' ', '/', $status); return $status; } - } diff --git a/app/Models/Voucher.php b/app/Models/Voucher.php index bff3e215..81fe635a 100644 --- a/app/Models/Voucher.php +++ b/app/Models/Voucher.php @@ -31,7 +31,17 @@ class Voucher extends Model 'expires_at' ]; - protected $appends = ['used' , 'status']; + /** + * The attributes that should be cast to native types. + * + * @var array + */ + protected $casts = [ + 'credits' => 'float', + 'uses' => 'integer' + ]; + + protected $appends = ['used', 'status']; /** * @return int @@ -44,7 +54,8 @@ class Voucher extends Model /** * @return string */ - public function getStatusAttribute(){ + public function getStatusAttribute() + { return $this->getStatus(); }