Skip to content

Commit

Permalink
fix: set only default image_url if the value is null
Browse files Browse the repository at this point in the history
  • Loading branch information
phojie committed Nov 6, 2022
1 parent 84538a0 commit 618294e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ protected static function boot()
parent::boot();

static::creating(function ($model) {
$model->image_url = 'https://robohash.org/' . $model->id . '?set=set3&bgset=bg2&size=400x400';
if (!$model->image_url) {
$model->image_url = 'https://robohash.org/' . $model->id . '?set=set3&bgset=bg2&size=400x400';
}
});
}
}

0 comments on commit 618294e

Please sign in to comment.