Changeset View
Changeset View
Standalone View
Standalone View
src/app/UserAlias.php
Show All 12 Lines | |||||
*/ | */ | ||||
class UserAlias extends Model | class UserAlias extends Model | ||||
{ | { | ||||
protected $fillable = [ | protected $fillable = [ | ||||
'user_id', 'alias' | 'user_id', 'alias' | ||||
]; | ]; | ||||
/** | /** | ||||
* Ensure the email address is appropriately cased. | |||||
* | |||||
* @param string $alias Email address | |||||
*/ | |||||
public function setAliasAttribute(string $alias) | |||||
{ | |||||
$this->attributes['alias'] = \strtolower($alias); | |||||
} | |||||
/** | |||||
* The user to which this alias belongs. | * The user to which this alias belongs. | ||||
* | * | ||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
*/ | */ | ||||
public function user() | public function user() | ||||
{ | { | ||||
return $this->belongsTo('\App\User', 'user_id', 'id'); | return $this->belongsTo('\App\User', 'user_id', 'id'); | ||||
} | } | ||||
} | } |