Skip to content

Commit

Permalink
Refactor avatar accessor in User model
Browse files Browse the repository at this point in the history
  • Loading branch information
range-of-motion committed Oct 2, 2020
1 parent 50d888f commit 88ca164
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class User extends Authenticatable
];

// Accessors
public function getAvatarAttribute($avatar)
public function getAvatarPathAttribute($avatar)
{
return $avatar ? '/storage/avatars/' . $avatar : 'https://via.placeholder.com/250';
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/activities/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="box__section row">
<div class="row__column row__column--compact mr-2" style="width: 25px;">
@if ($activity->user)
<img class="avatar" src="{{ $activity->user->avatar }}" />
<img class="avatar" src="{{ $activity->user->avatar_path }}" />
@endif
</div>
<div class="row__column row__column--middle">{{ __('activities.' . $activity->action) }} <a href="/{{ $activity->entity_type }}s/{{ $activity->entity_id }}">#{{ $activity->entity_id }}</a></div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<li>
<dropdown>
<span slot="button">
<img src="{{ Auth::user()->avatar }}" class="avatar mr-05" /> <i class="fas fa-caret-down fa-sm"></i>
<img src="{{ Auth::user()->avatar_path }}" class="avatar mr-05" /> <i class="fas fa-caret-down fa-sm"></i>
</span>
<ul slot="menu" v-cloak>
<li>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/settings/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="box__section">
<div class="input input--small">
<label>{{ __('fields.avatar') }}</label>
<img src="{{ Auth::user()->avatar }}" style="width: 200px; height: 200px; border-radius: 5px; object-fit: cover;" />
<img src="{{ Auth::user()->avatar_path }}" style="width: 200px; height: 200px; border-radius: 5px; object-fit: cover;" />
<input type="file" name="avatar" />
@include('partials.validation_error', ['payload' => 'avatar'])
</div>
Expand Down

0 comments on commit 88ca164

Please sign in to comment.