PHP code example of noopstudios / filament-edit-profile
1. Go to this page and download the library: Download noopstudios/filament-edit-profile library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
noopstudios / filament-edit-profile example snippets
public bool $shouldEditEmail = true;
public bool $shouldConfirmEmail = false;
use NoopStudios\FilamentEditProfile\FilamentEditProfilePlugin;
->plugins([
FilamentEditProfilePlugin::make()
->shouldEditEmail(true) // Enable or disable email editing
->shouldConfirmEmail(true) // Enable or disable email verification
])
use NoopStudios\FilamentEditProfile\FilamentEditProfilePlugin;
->plugins([
FilamentEditProfilePlugin::make()
])
use Filament\Navigation\MenuItem;
use NoopStudios\FilamentEditProfile\Pages\EditProfilePage;
->userMenuItems([
'profile' => MenuItem::make()
->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();
}),
])
return [
'disk' => env('FILESYSTEM_DISK', 'public'),
'visibility' => 'public', // or replace by filesystem disk visibility with fallback value
];
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class User extends Authenticatable implements HasMedia
{
use InteractsWithMedia;
// ... rest of your model
}
->shouldShowAvatarForm(
value: true,
directory: 'avatars', // image will be stored based on Spatie Media Library's configuration
rules: 'mimes:jpeg,png|max:1024' //only accept jpeg and png files with a maximum size of 1MB
)
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
}