Changeset View
Changeset View
Standalone View
Standalone View
src/app/Sku.php
Show All 15 Lines | protected $casts = [ | ||||
'units_free' => 'integer' | 'units_free' => 'integer' | ||||
]; | ]; | ||||
protected $fillable = [ | protected $fillable = [ | ||||
'title', | 'title', | ||||
'description', | 'description', | ||||
'cost', | 'cost', | ||||
'units_free', | 'units_free', | ||||
// persist for annual domain registration | |||||
'period', | 'period', | ||||
'handler_class', | 'handler_class', | ||||
'active' | 'active' | ||||
]; | ]; | ||||
/** | /** | ||||
* List the entitlements that consume this SKU. | * List the entitlements that consume this SKU. | ||||
* | * | ||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | * @return \Illuminate\Database\Eloquent\Relations\HasMany | ||||
*/ | */ | ||||
public function entitlements() | public function entitlements() | ||||
{ | { | ||||
return $this->hasMany('App\Entitlement'); | return $this->hasMany('App\Entitlement'); | ||||
} | } | ||||
public function packages() | public function packages() | ||||
{ | { | ||||
return $this->belongsToMany( | return $this->belongsToMany( | ||||
'App\Package', | 'App\Package', | ||||
'package_skus' | 'package_skus' | ||||
)->using('App\PackageSku')->withPivot(['qty']); | )->using('App\PackageSku')->withPivot(['cost', 'qty']); | ||||
} | } | ||||
} | } |