Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

luadotsh/lua

324 stars
2 code files
View luadotsh/lua on GitHub

app/Models/User.php

Open in GitHub
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\MediaLibrary\HasMedia;
 
class User extends Authenticatable implements MustVerifyEmail, HasMedia
{
// ...
 
public function getPhotoUrlAttribute()
{
return $this->hasMedia('photos')
? $this->getFirstMediaUrl('photos')
: "https://api.dicebear.com/7.x/initials/svg?backgroundType=gradientLinear&fontFamily=Helvetica&fontSize=40&seed=".urlencode($this->name);
}
}

resources/js/Components/UserAvatar.vue

Open in GitHub
<script setup>
const { size } = defineProps({
user: {
type: Object,
required: true,
},
 
size: {
type: String,
default: "md",
},
});
 
// ...
</script>
 
<template>
<img
:src="user.photo_url"
:class="userSize"
:alt="user.name"
class="rounded-full"
/>
</template>

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.