Changeset View
Changeset View
Standalone View
Standalone View
src/app/Entitlement.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | protected $fillable = [ | ||||
'owner_id', | 'owner_id', | ||||
'wallet_id', | 'wallet_id', | ||||
'entitleable_id', | 'entitleable_id', | ||||
'entitleable_type', | 'entitleable_type', | ||||
'cost', | 'cost', | ||||
'description' | 'description' | ||||
]; | ]; | ||||
protected $casts = [ | |||||
'cost' => 'integer', | |||||
]; | |||||
/** | /** | ||||
* Principally entitleable objects such as 'Domain' or 'User'. | * Principally entitleable objects such as 'Domain' or 'User'. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function entitleable() | public function entitleable() | ||||
{ | { | ||||
return $this->morphTo(); | return $this->morphTo(); | ||||
Show All 23 Lines | class Entitlement extends Model | ||||
* The wallet this entitlement is being billed to | * The wallet this entitlement is being billed to | ||||
* | * | ||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
*/ | */ | ||||
public function wallet() | public function wallet() | ||||
{ | { | ||||
return $this->belongsTo('App\Wallet'); | return $this->belongsTo('App\Wallet'); | ||||
} | } | ||||
/** | |||||
* Cost mutator. Make sure cost is integer. | |||||
*/ | |||||
public function setCostAttribute($cost): void | |||||
{ | |||||
$this->attributes['cost'] = round($cost); | |||||
} | |||||
} | } |