Add ability to set custom avatar

This commit is contained in:
2026-01-08 18:47:31 +01:00
parent ab4e7c7999
commit fb3722036a
9 changed files with 105 additions and 39 deletions

View File

@@ -23,10 +23,36 @@
@csrf
</form>
<form method="post" action="{{ route('profile.update') }}" class="mt-6 space-y-6">
<form method="post" action="{{ route('profile.update') }}" class="mt-6 space-y-6" enctype="multipart/form-data">
@csrf
@method('patch')
<div>
<x-input-label for="image" :value="__('Avatar')" />
<div class="mt-2 flex items-center gap-4">
<img
src="{{ $user->getAvatar() }}"
alt="{{ $user->name }}"
class="h-16 w-16 rounded-full object-cover"
>
<input
id="image"
name="image"
type="file"
accept="image/*"
class="block w-full text-sm text-gray-900 dark:text-gray-100
file:mr-4 file:rounded-md file:border-0
file:bg-rose-600 file:px-4 file:py-2
file:text-sm file:font-semibold file:text-white
hover:file:bg-rose-500"
/>
</div>
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
JPG, PNG, WebP or GIF. Max 8MB. Will be cropped to 128×128.
</p>
<x-input-error class="mt-2" :messages="$errors->get('image')" />
</div>
<div>
<x-input-label for="name" :value="__('Name')" />
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full" :value="old('name', $user->name)" required autofocus autocomplete="name" />