Changeset View
Changeset View
Standalone View
Standalone View
src/app/Entitlement.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||
/** | /** | ||||
* The eloquent definition of an Entitlement. | * The eloquent definition of an Entitlement. | ||||
* | * | ||||
* Owned by a {@link \App\User}, billed to a {@link \App\Wallet}. | * Owned by a {@link \App\User}, billed to a {@link \App\Wallet}. | ||||
* | |||||
* @property \App\User $owner The owner of this entitlement (subject). | |||||
* @property \App\Sku $sku The SKU to which this entitlement applies. | |||||
* @property \App\Wallet $wallet The wallet to which this entitlement is charged. | |||||
* @property \App\Domain|\App\User $entitleable The entitled object (receiver of the entitlement). | |||||
*/ | */ | ||||
class Entitlement extends Model | class Entitlement extends Model | ||||
{ | { | ||||
/** | /** | ||||
* This table does not use auto-increment. | * This table does not use auto-increment. | ||||
* | * | ||||
* @var boolean | * @var boolean | ||||
*/ | */ | ||||
Show All 16 Lines | protected $fillable = [ | ||||
'owner_id', | 'owner_id', | ||||
'wallet_id', | 'wallet_id', | ||||
'entitleable_id', | 'entitleable_id', | ||||
'entitleable_type', | 'entitleable_type', | ||||
'description' | 'description' | ||||
]; | ]; | ||||
/** | /** | ||||
* Principally entitleable objects such as 'Domain' or 'Mailbox'. | * Principally entitleable objects such as 'Domain' or 'User'. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function entitleable() | public function entitleable() | ||||
{ | { | ||||
return $this->morphTo(); | return $this->morphTo(); | ||||
} | } | ||||
/** | /** | ||||
* The SKU concerned. | * The SKU concerned. | ||||
* | * | ||||
* @return Sku | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
*/ | */ | ||||
public function sku() | public function sku() | ||||
{ | { | ||||
return $this->belongsTo('App\Sku'); | return $this->belongsTo('App\Sku'); | ||||
} | } | ||||
/** | /** | ||||
* The owner of this entitlement. | * The owner of this entitlement. | ||||
* | * | ||||
* @return User | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
*/ | */ | ||||
public function owner() | public function owner() | ||||
{ | { | ||||
return $this->belongsTo('App\User', 'owner_id', 'id'); | return $this->belongsTo('App\User', 'owner_id', 'id'); | ||||
} | } | ||||
/** | /** | ||||
* The wallet this entitlement is being billed to | * The wallet this entitlement is being billed to | ||||
* | * | ||||
* @return Wallet | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
*/ | */ | ||||
public function wallet() | public function wallet() | ||||
{ | { | ||||
return $this->belongsTo('App\Wallet'); | return $this->belongsTo('App\Wallet'); | ||||
machniak: This is against what Laravel documentation does. I think this is wrong. | |||||
Done Inline ActionsYeah, it is indeed. vanmeeuwen: Yeah, it is indeed. | |||||
} | } | ||||
} | } |
This is against what Laravel documentation does. I think this is wrong.