AppUserRolesEnum::class ]; /** * fillable * @var string[] */ protected $fillable = [ 'lastname', 'firstname', 'email', 'password', 'authorizedFolders', 'role', 'status', ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted() { static::creating(function (self $model) { $model->lastname = strtoupper($model->lastname); $model->firstname = ucfirst(strtolower($model->firstname)); $model->password = Hash::make($model->password); }); static::updating(function (self $model) { $model->lastname = strtoupper($model->lastname); $model->firstname = ucfirst(strtolower($model->firstname)); if (Hash::needsRehash($model->password)) { $model->password = Hash::make($model->password); } }); } }