### Install Filament Edit Profile Package Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Commands for installing the package, publishing its assets, and running necessary migrations. Includes options for interactive installation and individual asset publishing. ```bash # Install the package composer require joaopaulolndev/filament-edit-profile:^3.0 # Interactive installer (publishes config, runs migrations, offers GitHub star) php artisan filament-edit-profile:install # Or publish assets individually: php artisan vendor:publish --tag="filament-edit-profile-config" php artisan vendor:publish --tag="filament-edit-profile-views" php artisan vendor:publish --tag="filament-edit-profile-translations" # Feature-specific migrations (publish then migrate): php artisan vendor:publish --tag="filament-edit-profile-avatar-migration" php artisan vendor:publish --tag="filament-edit-profile-locale-migration" php artisan vendor:publish --tag="filament-edit-profile-theme-color-migration" php artisan vendor:publish --tag="filament-edit-profile-custom-field-migration" php artisan migrate # Link storage for avatar uploads php artisan storage:link ``` -------------------------------- ### Install Filament Edit Profile Package Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Use this composer command to install the package. Ensure you are using the correct version tag for your Filament installation. ```bash composer require joaopaulolndev/filament-edit-profile:^3.0 ``` -------------------------------- ### Install Laravel Sanctum Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Installs Laravel Sanctum using the Artisan command. This is a prerequisite for managing API tokens. ```bash php artisan install:api ``` -------------------------------- ### Configure Custom Fields Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Example of configuring custom fields with optional rules and column span settings. ```php 'rules' => [], // optional 'column_span' => 'full', // optional ], ]; ``` -------------------------------- ### Add User Menu Item for Profile Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Create a user menu item that links to the profile edit page. Ensure visibility checks are in place, especially for tenancy setups. ```php use Filament\Actions\Action; use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage; ->userMenuItems([ 'profile' => Action::make('profile') ->label(fn() => auth()->user()->name) ->url(fn (): string => EditProfilePage::getUrl()) ->icon('heroicon-m-user-circle') //If you are using tenancy need to check with the visible method where ->company() is the relation between the user and tenancy model as you called ->visible(function (): bool { return auth()->user()->company()->exists(); }), ]) ``` -------------------------------- ### Configure Sanctum Token Manager in Filament Profile Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Renders a CRUD table for managing Laravel Sanctum personal access tokens on the profile page. Requires Laravel Sanctum installation and optionally supports custom permissions and conditional visibility. ```php use Laravel\Sanctum\HasApiTokens; // User model class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable; } // Plugin configuration FilamentEditProfilePlugin::make() ->shouldShowSanctumTokens( condition: fn () => auth()->user()?->hasRole('developer'), // optional permissions: [ 'read' => 'Read', 'write' => 'Write', 'delete' => 'Delete', ] ) // The table supports: // - Create token modal (name, abilities checkboxes, optional expiry date picker) // - One-time plain-text token display modal after creation // - Per-row delete action // - Expired tokens highlighted in danger color ``` -------------------------------- ### Publish and Run Filament Edit Profile Migrations Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Publish all package migrations and then run them using these artisan commands. ```bash php artisan vendor:publish --tag="filament-edit-profile-migrations" php artisan migrate ``` -------------------------------- ### Configure Avatar Disk and Visibility Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Set the filesystem disk and visibility for avatar images in the `config/filament-edit-profile.php` file. ```php return [ 'disk' => env('FILESYSTEM_DISK', 'public'), 'visibility' => 'public', // or replace by filesystem disk visibility with fallback value ]; ``` -------------------------------- ### Publish and Migrate Locale Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Publish the migration file and run migrations to add the locale field to the users table. ```bash php artisan vendor:publish --tag="filament-edit-profile-locale-migration" php artisan migrate ``` -------------------------------- ### Publish and Migrate Theme Color Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Publish the migration file and run migrations to add the theme_color field to the users table. ```bash php artisan vendor:publish --tag="filament-edit-profile-theme-color-migration" php artisan migrate ``` -------------------------------- ### Publish Custom Field Migration Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Run this command to publish the migration file for adding custom fields to the users table. Ensure you run `php artisan migrate` afterwards. ```bash php artisan vendor:publish --tag="filament-edit-profile-custom-field-migration" php artisan migrate ``` -------------------------------- ### Publish Filament Edit Profile Views Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Optionally publish the package's views using this artisan command. ```bash php artisan vendor:publish --tag="filament-edit-profile-views" ``` -------------------------------- ### Run Project Tests Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Execute the project's test suite using composer. This command runs all defined tests to ensure code integrity. ```bash composer test ``` -------------------------------- ### Scaffold a Custom Profile Component Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Use the artisan command to generate a new Livewire component for the profile page. This command sets up the necessary files and traits for customization. ```bash php artisan make:edit-profile-form SocialLinksForm ``` -------------------------------- ### Publish and Migrate Avatar Migration Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Run Artisan commands to publish the migration file for the avatar field and then apply the migration. ```bash php artisan vendor:publish --tag="filament-edit-profile-avatar-migration" php artisan migrate ``` -------------------------------- ### Configure Browser Sessions Manager in Filament Profile Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Displays active database sessions for the user and allows logging out other devices. Requires the session driver to be set to 'database'. ```php // .env SESSION_DRIVER=database // Plugin configuration FilamentEditProfilePlugin::make() ->shouldShowBrowserSessionsForm( fn () => auth()->user()?->id !== null // always show (default); pass false to disable ) // Under the hood, BrowserSessionsForm::getSessions() queries the sessions table: // DB::table('sessions') // ->where('user_id', Auth::id()) // ->latest('last_activity') // ->get() // and maps each row to: device info (browser, platform, mobile/desktop/tablet), // ip_address, is_current_device, and last_active (human-readable diff). ``` -------------------------------- ### Publish Filament Edit Profile Config Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Publish the package's configuration file using this artisan command. ```bash php artisan vendor:publish --tag="filament-edit-profile-config" ``` -------------------------------- ### Configure Custom Fields in `config/filament-edit-profile.php` Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Define custom fields in the `config/filament-edit-profile.php` file. Each field requires a `type` and `label`, with many optional parameters for customization. ```php true, 'custom_fields' => [ 'custom_field_1' => [ 'type' => 'text', // required 'label' => 'Custom Textfield 1', // required 'placeholder' => 'Custom Field 1', // optional 'id' => 'custom-field-1', // optional 'required' => true, // optional 'rules' => [], // optional 'hint_icon' => '', // optional 'hint' => '', // optional 'suffix_icon' => '', // optional 'prefix_icon' => '', // optional 'default' => '', // optional 'column_span' => 'full', // optional 'autocomplete' => false, // optional ], 'custom_field_2' => [ 'type' => 'password', // required 'label' => 'Custom Password field 2', // required 'placeholder' => 'Custom Password Field 2', // optional 'id' => 'custom-field-2', // optional 'required' => true, // optional 'rules' => [], // optional 'hint_icon' => '', // optional 'hint' => '', // optional 'default' => '', // optional 'column_span' => 'full', 'revealable' => true, // optional 'autocomplete' => true, // optional ], 'custom_field_3' => [ 'type' => 'select', // required 'label' => 'Custom Select 3', // required 'placeholder' => 'Select', // optional 'id' => 'custom-field-3', // optional 'required' => true, // optional 'options' => [ 'option_1' => 'Option 1', 'option_2' => 'Option 2', 'option_3' => 'Option 3', ], // optional 'selectable_placeholder' => true // optional 'native' => true // optional 'preload' => true // optional 'suffix_icon' => '', // optional 'default' => '', // optional 'searchable' => true, // optional 'column_span' => 'full', // optional 'rules' => [], // optional 'hint_icon' => '', // optional 'hint' => '', // optional ], 'custom_field_4' => [ 'type' =>'textarea', // required 'label' => 'Custom Textarea 4', // required 'placeholder' => 'Textarea', // optional 'id' => 'custom-field-4', // optional 'rows' => '3', // optional 'required' => true, // optional 'hint_icon' => '', // optional 'hint' => '', // optional 'default' => '', // optional 'rules' => [], // optional 'column_span' => 'full', // optional ], 'custom_field_5' => [ 'type' => 'datetime', // required 'label' => 'Custom Datetime 5', // required 'placeholder' => 'Datetime', // optional 'id' => 'custom-field-5', // optional 'seconds' => false, // optional 'required' => true, // optional 'hint_icon' => '', // optional 'hint' => '', // optional 'default' => '', // optional 'suffix_icon' => '', // optional 'prefix_icon' => '', // optional 'rules' => [], // optional 'format' => 'Y-m-d H:i:s', // optional 'time' => true, // optional 'native' => true, // optional 'column_span' => 'full', // optional ], 'custom_field_6' => [ 'type' => 'boolean', // required 'label' => 'Custom Boolean 6', // required 'placeholder' => 'Boolean', // optional 'id' => 'custom-field-6', // optional 'hint_icon' => '', // optional 'hint' => '', // optional 'default' => '', // optional ``` -------------------------------- ### Configure Theme Color Form Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Configure the theme color form and set optional validation rules. ```php ->shouldShowThemeColorForm(rules: 'required') // optional validation rules, e.g. 'required|regex:/^#?[0-9a-fA-F]{6}$/' ``` -------------------------------- ### Configure Theme Color Form in Filament Profile Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Adds a color picker for users to select their primary Filament color. Requires publishing and running theme color migrations, and adding 'theme_color' to the User model's fillable properties. ```php // 1. Publish & run migration // php artisan vendor:publish --tag="filament-edit-profile-theme-color-migration" // php artisan migrate // 2. User model protected $fillable = ['name', 'email', 'password', 'theme_color']; // 3. Plugin configuration FilamentEditProfilePlugin::make() ->shouldShowThemeColorForm( rules: 'required|regex:/^#?[0-9a-fA-F]{6}$/' ) ``` -------------------------------- ### Publish Filament Edit Profile Translations Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Optionally publish the package's translation files using this artisan command. ```bash php artisan vendor:publish --tag="filament-edit-profile-translations" ``` -------------------------------- ### Configure Avatar Form Options Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Optionally specify the directory and validation rules for avatar uploads when using `shouldShowAvatarForm()`. ```php ->shouldShowAvatarForm( value: true, directory: 'avatars', // image will be stored in 'storage/app/public/avatars rules: 'mimes:jpeg,png|max:1024' //only accept jpeg and png files with a maximum size of 1MB ) ``` -------------------------------- ### Configure Filament Edit Profile Settings Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt This configuration file allows you to override default database column names and configure storage settings for avatar uploads. It also enables the definition of custom fields. ```php return [ // Database column names (override if your users table uses different names) 'name_column' => 'name', 'locale_column' => 'locale', 'theme_color_column' => 'theme_color', 'avatar_column' => 'avatar_url', // Storage settings for avatar uploads 'disk' => env('FILESYSTEM_DISK', 'public'), 'visibility' => 'public', // Custom fields (set show_custom_fields => true and define fields) 'show_custom_fields' => false, 'custom_fields' => [], ]; ``` -------------------------------- ### Implement a Custom Profile Component Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt This Livewire component extends the user profile page, allowing for custom form fields. It uses the `HasSort` trait to control its rendering order and defines its form schema and save logic. ```php namespace App\Livewire; use Filament\Forms\Concerns\InteractsWithForms; use Filament\Forms\Contracts\HasForms; use Filament\Schemas\Components\Section; use Filament\Schemas\Schema; use Filament\Forms\Components\TextInput; use Filament\Notifications\Notification; use Joaopaulolndev\FilamentEditProfile\Concerns\HasSort; use Livewire\Component; use Illuminate\Contracts\View\View; class SocialLinksForm extends Component implements HasForms { use InteractsWithForms; use HasSort; public ?array $data = []; // Controls render order relative to built-in sections (10=profile, 20=password, // 30=custom fields, 40=sanctum, 50=browser, 60=mfa, 70=delete) protected static int $sort = 25; public function mount(): void { $this->form->fill([ 'twitter' => auth()->user()->twitter ?? '', 'github' => auth()->user()->github ?? '', ]); } public function form(Schema $schema): Schema { return $schema ->components([ Section::make('Social Links') ->aside() ->description('Connect your social media profiles.') ->schema([ TextInput::make('twitter')->prefix('@'), TextInput::make('github')->prefix('github.com/'), ]), ]) ->statePath('data'); } public function save(): void { $data = $this->form->getState(); auth()->user()->update($data); Notification::make()->success()->title('Saved!')->send(); } public function render(): View { return view('livewire.social-links-form'); } } // Register in Panel Provider: FilamentEditProfilePlugin::make() ->customProfileComponents([ \App\Livewire\SocialLinksForm::class, ]) ``` -------------------------------- ### Configure FilamentEditProfilePlugin with Custom Parameters Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Customize the plugin's behavior by setting various parameters like slug, titles, icons, access control, and form visibility. ```php use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin; ->plugins([ FilamentEditProfilePlugin::make() ->slug('my-profile') ->setTitle('My Profile') ->setNavigationLabel('My Profile') ->setNavigationGroup('Group Profile') ->setIcon('heroicon-o-user') ->setSort(10) ->canAccess(fn () => auth()->user()->id === 1) ->shouldRegisterNavigation(false) ->shouldShowEmailForm() ->shouldShowLocaleForm( options: [ 'pt_BR' => '🇧🇷 Português', 'en' => '🇺🇸 Inglês', 'es' => '🇪🇸 Espanhol', ], rules: 'required' // optional validation rules for the locale field ) ->shouldShowThemeColorForm(rules: 'required') // optional validation rules for the theme color field ->shouldShowDeleteAccountForm(false) ->shouldShowSanctumTokens() ->shouldShowMultiFactorAuthentication() ->shouldShowBrowserSessionsForm() ->shouldShowAvatarForm() ->customProfileComponents([ \App\Livewire\CustomProfileComponent::class, ]) ]) ``` -------------------------------- ### Configure Avatar Upload Form Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Enable and configure the avatar upload field. Requires migration, User model implementation, and plugin configuration for directory, rules, and storage disk. ```php // 1. Publish & run migration // php artisan vendor:publish --tag="filament-edit-profile-avatar-migration" // php artisan migrate // 2. User model use Filament\Models\Contracts\HasAvatar; use Illuminate\Support\Facades\Storage; class User extends Authenticatable implements HasAvatar { protected $fillable = ['name', 'email', 'password', 'avatar_url']; public function getFilamentAvatarUrl(): ?string { $col = config('filament-edit-profile.avatar_column', 'avatar_url'); return $this->$col ? Storage::url($this->$col) : null; } } // 3. Plugin configuration FilamentEditProfilePlugin::make() ->shouldShowAvatarForm( value: true, directory: 'avatars', // stored at storage/app/public/avatars rules: 'mimes:jpeg,png|max:2048' ) // 4. config/filament-edit-profile.php (optional disk override) return [ 'disk' => env('FILESYSTEM_DISK', 'public'), 'visibility' => 'public', ]; ``` -------------------------------- ### Enable Email Change Verification in Filament Panel Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Integrates Filament's email change verification flow with the plugin. No plugin-side configuration is needed beyond enabling it in the Panel Provider. ```php // app/Providers/Filament/AdminPanelProvider.php use Filament obago; use Filament obagoProvider; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel ->emailChangeVerification() // enables the flow ->plugins([ FilamentEditProfilePlugin::make(), ]); } } // The plugin's EmailChangeVerificationResponse redirects back to // the profile page after the user clicks the verification link: // Joaopaulolndev\FilamentEditProfile\Http\Responses\EmailChangeVerificationResponse ``` -------------------------------- ### Add FilamentEditProfilePlugin to AdminPanelProvider Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Integrate the plugin by adding it to the plugins array in your AdminPanelProvider.php file. ```php use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin; ->plugins([ FilamentEditProfilePlugin::make() ]) ``` -------------------------------- ### Control MFA Section Visibility with a Condition Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Conditionally displays the Multi-Factor Authentication section based on a closure. The section is only visible if the closure returns true. ```php ->plugins([ FilamentEditProfilePlugin::make() ->shouldShowMultiFactorAuthentication( // The section will only be visible to the user with ID 1. fn() => auth()->user()->id === 1, //optional //OR false //optional ) ]) ``` -------------------------------- ### Configure Profile Locale Form Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Configure the locale form to display available language options and set optional validation rules. ```php ->shouldShowLocaleForm( options: [ 'pt_BR' => '🇧🇷 Português', 'en' => '🇺🇸 Inglês', 'es' => '🇪🇸 Espanhol', ], rules: 'required' // optional validation rules, e.g. 'required|in:pt_BR,en,es' ) ``` -------------------------------- ### Configure Sanctum Token Visibility and Permissions Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Conditionally displays the Sanctum token management component and sets custom token permissions. The condition is optional and defaults to always showing if not specified. ```php ->plugins([ FilamentEditProfilePlugin::make() ->shouldShowSanctumTokens( condition: fn() => auth()->user()->id === 1, //optional permissions: ['custom', 'abilities', 'permissions'] //optional ) ]) ``` -------------------------------- ### Set Session Driver to Database Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Configures the session driver to 'database' for browser session management. This is required for the browser sessions feature to function correctly. ```env SESSION_DRIVER=database ``` -------------------------------- ### Configure Multi-Factor Authentication Visibility Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Control the visibility of the MFA section on the profile page. It can be shown for specific users or disabled entirely. Defaults to showing if Filament has MFA enabled. ```php FilamentEditProfilePlugin::make() ->shouldShowMultiFactorAuthentication( fn () => auth()->user()?->id === 1 // or simply: true / false ) ``` ```php // To disable for all users: FilamentEditProfilePlugin::make() ->shouldShowMultiFactorAuthentication(false) ``` ```php // Default: shown for all users when Filament::hasMultiFactorAuthentication() is true ``` -------------------------------- ### Register Custom Profile Component in Panel Provider Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Register your custom profile component within the Filament panel provider configuration. Ensure the path to your component class is correct. ```php ->plugins([ FilamentEditProfilePlugin::make() ->customProfileComponents([ \App\Livewire\CustomProfileComponent::class, ]); ]) ``` -------------------------------- ### Add User Menu Item for Profile Page Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Add a link to the user profile page in the top-right user dropdown menu using EditProfilePage::getUrl(). ```php use Filament\Actions\Action; use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage; ->userMenuItems([ 'profile' => Action::make('profile') ->label(fn () => auth()->user()->name) ->url(fn (): string => EditProfilePage::getUrl()) ->icon('heroicon-m-user-circle') // For tenancy: only show if the user belongs to a company ->visible(fn (): bool => auth()->user()->company()->exists()), ]) ``` -------------------------------- ### Configure Locale Form in Filament Profile Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Enables a language select field on the profile form. Requires publishing and running migrations, and adding 'locale' to the User model's fillable properties. ```php // 1. Publish & run migration // php artisan vendor:publish --tag="filament-edit-profile-locale-migration" // php artisan migrate // 2. User model protected $fillable = ['name', 'email', 'password', 'locale']; // 3. Plugin configuration FilamentEditProfilePlugin::make() ->shouldShowLocaleForm( options: [ 'en' => '🇺🇸 English', 'pt_BR' => '🇧🇷 Português', 'es' => '🇪🇸 Español', 'de' => '🇩🇪 Deutsch', ], rules: 'required|in:en,pt_BR,es,de' ) ``` -------------------------------- ### Enable Email Change Verification in Panel Provider Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Enable the email change verification feature by adding the `emailChangeVerification()` method to your Panel Provider configuration. ```php use Filament\Panel; use Filament\PanelProvider; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->emailChangeVerification(); } } ``` -------------------------------- ### Register Filament Edit Profile Plugin Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Register the plugin in your Filament panel provider. Customize slug, title, navigation label, icon, sort order, access control, and navigation visibility. ```php use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin; use Filament\Pages\Page; public function panel(Panel $panel): Panel { return $panel ->id('admin') ->path('admin') ->plugins([ FilamentEditProfilePlugin::make() ->slug('my-profile') ->setTitle('My Profile') ->setNavigationLabel('My Profile') ->setNavigationGroup('Account') ->setIcon('heroicon-o-user-circle') ->setSort(10) // Only admin (id=1) can access the profile page ->canAccess(fn () => auth()->user()?->id === 1) // Hide from the sidebar navigation ->shouldRegisterNavigation(false), ]); } ``` -------------------------------- ### Configure Custom Fields for User Profile Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Adds a 'Custom Fields' section to the profile page using a JSON column in the users table. Supports various field types and can be configured via a published config file. ```bash // 1. Publish & run migration // php artisan vendor:publish --tag="filament-edit-profile-custom-field-migration" // php artisan migrate ``` ```php // 2. User model protected $fillable = ['name', 'email', 'password', 'custom_fields']; protected function casts(): array { return [ 'custom_fields' => 'array', ]; } ``` ```php // 3. config/filament-edit-profile.php return [ 'show_custom_fields' => true, 'custom_fields' => [ 'bio' => [ 'type' => 'textarea', 'label' => 'Biography', 'placeholder' => 'Tell us about yourself...', 'rows' => '4', 'required' => false, 'column_span' => 'full', ], 'website' => [ 'type' => 'text', 'label' => 'Website URL', 'placeholder' => 'https://example.com', 'prefix_icon' => 'heroicon-o-globe-alt', 'rules' => ['url'], 'column_span' => 'full', ], 'role_level' => [ 'type' => 'select', 'label' => 'Role Level', 'options' => ['junior' => 'Junior', 'mid' => 'Mid', 'senior' => 'Senior'], 'required' => true, ], 'notify_weekly' => [ 'type' => 'boolean', 'label' => 'Receive Weekly Digest', 'default' => false, ], ], ]; ``` -------------------------------- ### Implement getFilamentAvatarUrl Method in User Model Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Implement the `getFilamentAvatarUrl` method in your User model to provide the avatar URL, respecting the configured avatar column. ```php use Filament\Models\Contracts\HasAvatar; use Illuminate\Support\Facades\Storage; class User extends Authenticatable implements HasAvatar { // ... public function getFilamentAvatarUrl(): ?string { $avatarColumn = config('filament-edit-profile.avatar_column', 'avatar_url'); return $this->$avatarColumn ? Storage::url($this->$avatarColumn) : null; } } ``` -------------------------------- ### Completely Disable MFA Section Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Completely hides the Multi-Factor Authentication section for all users by passing false to the shouldShowMultiFactorAuthentication method. ```php ->plugins([ FilamentEditProfilePlugin::make() ->shouldShowMultiFactorAuthentication(false) ]) ``` -------------------------------- ### Generate Custom Profile Component Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Use this artisan command to generate a new custom profile edit component. This creates a PHP class and a Blade view for customization. ```bash php artisan make:edit-profile-form CustomProfileComponent ``` -------------------------------- ### Add Custom Fields to User Model Fillable Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Modify the `$fillable` array in your `User` model to include the custom fields you intend to use. This is necessary for mass assignment. ```php protected $fillable = [ 'name', 'email', 'password', 'custom_fields', ]; ``` -------------------------------- ### Use Sanctum HasApiTokens Trait Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Applies the HasApiTokens trait to the User model to enable Sanctum API token functionality. ```php use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable; } ``` -------------------------------- ### Add Theme Color Field to User Model Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Ensure the 'theme_color' field is included in the User model's fillable properties. ```php protected $fillable = [ 'name', 'email', 'password', 'theme_color', // or column name according to config('filament-edit-profile.theme_color_column', 'theme_color') ]; ``` -------------------------------- ### Configure Account Deletion Form Visibility Source: https://context7.com/joaopaulolndev/filament-edit-profile/llms.txt Control the visibility of the account deletion form. It can be hidden for specific user roles, such as administrators. The form requires password confirmation before deletion. ```php FilamentEditProfilePlugin::make() ->shouldShowDeleteAccountForm( fn () => ! auth()->user()?->hasRole('admin') // hide for admins ) ``` ```php // Internally the action verifies the password via Hash::check(), then calls: // auth()->user()->delete(); ``` -------------------------------- ### Control Browser Sessions Form Visibility Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Conditionally controls the visibility of the browser sessions form. Can be set to a boolean or a closure that returns a boolean. ```php ->plugins([ FilamentEditProfilePlugin::make() ->shouldShowBrowserSessionsForm( fn() => auth()->user()->id === 1, //optional //OR false //optional ) ]) ``` -------------------------------- ### Cast Custom Fields to Array in User Model Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Configure the `casts` array in your `User` model to ensure 'custom_fields' are treated as an array. This is crucial for proper data handling. ```php protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'custom_fields' => 'array' ]; } ``` -------------------------------- ### Add Locale Field to User Model Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Ensure the 'locale' field is included in the User model's fillable properties. ```php protected $fillable = [ 'name', 'email', 'password', 'locale', // or column name according to config('filament-edit-profile.locale_column', 'locale') ]; ``` -------------------------------- ### Add avatar_url to User Model Source: https://github.com/joaopaulolndev/filament-edit-profile/blob/3.x/README.md Ensure the `avatar_url` field (or your configured column name) is included in the `$fillable` array of your User model. ```php protected $fillable = [ 'name', 'email', 'password', 'avatar_url', // or column name according to config('filament-edit-profile.avatar_column', 'avatar_url') ]; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.