Skip to content

Commit

Permalink
Fix a bug with hitobito login that was introduced when adding laravel…
Browse files Browse the repository at this point in the history
…-fillable-relations

The laravel-fillable-relations package overwrote how the static
Model::create method works, and this broke with our current approach
for always setting the email of Hitobito users to verified. Fixed by
using a more standard approach for setting this (do it in the constructor
instead of the newInstance method)
  • Loading branch information
carlobeltrame committed Mar 15, 2020
1 parent fcc8ed3 commit 3270b18
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions app/Models/HitobitoUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ class HitobitoUser extends User {
public function __construct(...$args) {
$this->fillable[] = 'hitobito_id';
parent::__construct(...$args);
}

public function newInstance($attributes = [], $exists = false) {
return tap(parent::newInstance($attributes, $exists), function ($instance) {
$instance->email_verified_at = Carbon::now();
});
$this->email_verified_at = Carbon::now();
}
}

0 comments on commit 3270b18

Please sign in to comment.