Changeset View
Changeset View
Standalone View
Standalone View
src/app/Sku.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | class Sku extends Model | ||||
* | * | ||||
* @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'); | ||||
} | } | ||||
/** | |||||
* List of packages that use this SKU. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany | |||||
*/ | |||||
public function packages() | public function packages() | ||||
{ | { | ||||
return $this->belongsToMany( | return $this->belongsToMany( | ||||
'App\Package', | 'App\Package', | ||||
'package_skus' | 'package_skus' | ||||
)->using('App\PackageSku')->withPivot(['cost', 'qty']); | )->using('App\PackageSku')->withPivot(['cost', 'qty']); | ||||
} | } | ||||
} | } |