agenticmorf/fluxui-avatar
Drop-in avatar manager for Laravel 11 + Livewire 4 + Flux UI. Automatically displays the authenticated user’s avatar in <flux:avatar />, includes a ready-to-use upload component, validation, and storage via filesystem disk or Spatie Media Library—no starter-kit edits required.
^8.2^11.0^4.0composer require agenticmorf/fluxui-avatar
php artisan vendor:publish --tag=fluxui-avatar-config
Add the avatar_path column to your users table:
php artisan make:migration add_avatar_path_to_users_table --table=users
// database/migrations/xxxx_add_avatar_path_to_users_table.php
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('avatar_path')->nullable()->after('email');
});
}
php artisan migrate
Add avatar_path to your User model's $fillable array:
protected $fillable = [
'name',
'email',
'password',
'avatar_path',
];
Install Spatie Media Library:
composer require spatie/laravel-medialibrary
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"
php artisan migrate
Update your User model:
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class User extends Authenticatable implements HasMedia
{
use InteractsWithMedia;
public function registerMediaCollections(): void
{
$this->addMediaCollection('avatars')->singleFile();
}
}
Set the driver in your .env:
FLUXUI_AVATAR_DRIVER=spatie
{{-- resources/views/livewire/settings/profile.blade.php or similar --}}
<livewire:avatar-manager />
Run your application and navigate to your profile page. You should see the avatar upload component. Upload an image and verify it appears in the navigation header automatically.
If you need to customise the views:
php artisan vendor:publish --tag=fluxui-avatar-views
This copies the views to resources/views/vendor/fluxui-avatar/.
How can I help you explore Laravel packages today?