'datetime', ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted() { // * EVENT CLOSURES. static::creating(function (self $model) { static::updatePassword($model); }); static::updating(function (self $model) { static::updatePassword($model); }); } /** * Update password. * * @param self $model * @return void */ private static function updatePassword(self $model): void { if (Hash::needsRehash($model->password)) { $model->password = Hash::make($model->password); } } /** * Has Many Participation relation * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function participations() { return $this->hasMany(Participation::class, 'user_id'); } }