Merge pull request #213 from j122j/form-data-casts

Add form data casts for numbers
This commit is contained in:
AVMG 2021-10-03 19:18:03 +02:00 committed by GitHub
commit 7ca7e1273b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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();
}