Changeset View
Changeset View
Standalone View
Standalone View
src/app/User.php
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | class User extends Authenticatable implements JWTSubject | ||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | * @return \Illuminate\Database\Eloquent\Relations\HasMany | ||||
*/ | */ | ||||
public function entitlements() | public function entitlements() | ||||
{ | { | ||||
return $this->hasMany('App\Entitlement', 'entitleable_id', 'id') | return $this->hasMany('App\Entitlement', 'entitleable_id', 'id') | ||||
->where('entitleable_type', User::class); | ->where('entitleable_type', User::class); | ||||
} | } | ||||
public function addEntitlement($entitlement) | |||||
{ | |||||
if (!$this->entitlements->contains($entitlement)) { | |||||
return $this->entitlements()->save($entitlement); | |||||
} | |||||
} | |||||
/** | /** | ||||
* Find whether an email address exists as a user (including deleted users). | * Find whether an email address exists as a user (including deleted users). | ||||
* | * | ||||
* @param string $email Email address | * @param string $email Email address | ||||
* @param bool $return_user Return User instance instead of boolean | * @param bool $return_user Return User instance instead of boolean | ||||
* | * | ||||
* @return \App\User|bool True or User model object if found, False otherwise | * @return \App\User|bool True or User model object if found, False otherwise | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 354 Lines • Show Last 20 Lines |