Add form data casts for numbers

This commit is contained in:
Jovan Jovanovic 2021-10-02 18:29:32 +02:00
parent 991bd17528
commit 76d7710d0e
2 changed files with 15 additions and 3 deletions

View file

@ -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;
}
}

View file

@ -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();
}