Skip to content

Commit 859bf06

Browse files
Refactor avatar accessor in User model
1 parent ce03954 commit 859bf06

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

app/Models/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class User extends Authenticatable
2828
];
2929

3030
// Accessors
31-
public function getAvatarAttribute($avatar)
31+
public function getAvatarPathAttribute($avatar)
3232
{
3333
return $avatar ? '/storage/avatars/' . $avatar : 'https://via.placeholder.com/250';
3434
}

resources/views/activities/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="box__section row">
1111
<div class="row__column row__column--compact mr-2" style="width: 25px;">
1212
@if ($activity->user)
13-
<img class="avatar" src="{{ $activity->user->avatar }}" />
13+
<img class="avatar" src="{{ $activity->user->avatar_path }}" />
1414
@endif
1515
</div>
1616
<div class="row__column row__column--middle">{{ __('activities.' . $activity->action) }} <a href="/{{ $activity->entity_type }}s/{{ $activity->entity_id }}">#{{ $activity->entity_id }}</a></div>

resources/views/layout.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
<li>
101101
<dropdown>
102102
<span slot="button">
103-
<img src="{{ Auth::user()->avatar }}" class="avatar mr-05" /> <i class="fas fa-caret-down fa-sm"></i>
103+
<img src="{{ Auth::user()->avatar_path }}" class="avatar mr-05" /> <i class="fas fa-caret-down fa-sm"></i>
104104
</span>
105105
<ul slot="menu" v-cloak>
106106
<li>

resources/views/settings/profile.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<div class="box__section">
1010
<div class="input input--small">
1111
<label>{{ __('fields.avatar') }}</label>
12-
<img src="{{ Auth::user()->avatar }}" style="width: 200px; height: 200px; border-radius: 5px; object-fit: cover;" />
12+
<img src="{{ Auth::user()->avatar_path }}" style="width: 200px; height: 200px; border-radius: 5px; object-fit: cover;" />
1313
<input type="file" name="avatar" />
1414
@include('partials.validation_error', ['payload' => 'avatar'])
1515
</div>

0 commit comments

Comments
 (0)