### Install Filament Breezy Package
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Install the Filament Breezy package using Composer and run the Artisan command to set up Breezy.
```bash
composer require jeffgreco13/filament-breezy
php artisan breezy:install
```
--------------------------------
### User Model Implementation for Avatars
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Implement the HasAvatar contract in your User model to enable custom avatar functionality. This example shows how to get the avatar URL.
```php
use Illuminate\Support\Facades\Storage;
use Filament\Models\Contracts\HasAvatar;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements FilamentUser, HasAvatar
{
// ...
public function getFilamentAvatarUrl(): ?string
{
return $this->avatar_url ? Storage::url($this->avatar_url) : null;
}
}
```
--------------------------------
### Run Tests
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Execute the test suite for the Filament Breezy project.
```bash
composer test
```
--------------------------------
### Configure My Profile Page Options
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Enable and customize the My Profile page in Filament Breezy. Options include registration in user menu, navigation, and avatar handling.
```php
BreezyCore::make()
->myProfile(
shouldRegisterUserMenu: true, // Sets the 'account' link in the panel User Menu (default = true)
userMenuLabel: 'My Profile', // Customizes the 'account' link label in the panel User Menu (default = null)
shouldRegisterNavigation: false, // Adds a main navigation item for the My Profile page (default = false)
navigationGroup: 'Settings', // Sets the navigation group for the My Profile page (default = null)
hasAvatars: false, // Enables the avatar upload form component (default = false)
slug: 'my-profile' // Sets the slug for the profile page (default = 'my-profile')
)
```
--------------------------------
### Create Custom My Profile Component
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Define a custom Livewire component that extends Breezy's `MyProfileComponent` to add custom fields and logic to the My Profile page.
```bash
php artisan make:livewire MyCustomComponent
```
```php
use Jeffgreco13\FilamentBreezy\Livewire\MyProfileComponent;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
class MyCustomComponent extends MyProfileComponent
{
protected string $view = "livewire.my-custom-component";
public array $only = ['my_custom_field'];
public array $data;
public $user;
public $userClass;
// this example shows an additional field we want to capture and save on the user
public function mount()
{
$this->user = Filament::getCurrentPanel()->auth()->user();
$this->userClass = get_class($this->user);
$this->form->fill($this->user->only($this->only));
}
public function form(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('my_custom_field')
->required()
])
->statePath('data');
}
// only capture the custome component field
public function submit(): void
{
$data = collect($this->form->getState())->only($this->only)->all();
$this->user->update($data);
Notification::make()
->success()
->title(__('Custom component updated successfully'))
->send();
}
}
```
```blade
```
--------------------------------
### Enable Browser Sessions in Breezy Core
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Use the `enableBrowserSessions` method to activate the Browser Sessions feature. Ensure your session driver is set to `database`. The `condition` parameter defaults to `true`.
```php
BreezyCore::make()
->enableBrowserSessions(condition: true) // Enable the Browser Sessions feature (default = true)
```
--------------------------------
### Enable Passkeys Authentication
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Activate passkey authentication using the `enablePasskeys()` method. You can optionally configure the relying party name, ID, icon, and scope the feature to the current panel.
```php
BreezyCore::make()
->enablePasskeys(
relyingPartyName: 'My App', // optionally, change the passkey's party name (default = APP_NAME)
relyingPartyId: 'https://my-app.com', // optionally, change the passkey's party id (default = APP_URL)
relyingPartyIcon: '/logo.png', // optionally, change the passkey's party icon
scopeToPanel: true, // scope the passkeys only to the current panel (default = true)
)
```
--------------------------------
### Register Custom My Profile Component
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Register your custom Livewire component with Breezy to have it included in the My Profile page. Ensure the component class is correctly imported.
```php
use App\Livewire\MyCustomComponent;
BreezyCore::make()
->myProfileComponents([MyCustomComponent::class])
```
--------------------------------
### Publish Breezy Views
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Optionally, publish the Filament Breezy views to your application using the provided Artisan command.
```bash
php artisan vendor:publish --tag="filament-breezy-views"
```
--------------------------------
### Override My Profile Components
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Replace default My Profile components with custom ones by providing a map of component names to their class names. Ensure custom components are correctly implemented.
```php
use App\Livewire\MyCustomComponent;
BreezyCore::make()
->myProfileComponents([
// 'personal_info' => ,
'update_password' => MyCustomComponent::class, // replaces UpdatePassword component with your own.
// 'two_factor_authentication' => ,
// 'sanctum_tokens' =>
// 'browser_sessions' =>
])
```
--------------------------------
### Customize Passkeys Component
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Replace the default passkeys component with a custom Livewire component by defining it within the `myProfileComponents` method.
```php
BreezyCore::make()
->myProfileComponents([
'passkeys' => \App\Livewire\CustomPasskeys::class, // Your custom component
])
```
--------------------------------
### Sort My Profile Components
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Control the order of My Profile components by setting their static `$sort` property. Default spacing allows for custom component insertion.
```php
TwoFactorAuthentication::setSort(4);
```
--------------------------------
### Register Custom My Profile Page Class
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Use a custom class for the My Profile page by extending the default Breezy page and registering it with the plugin.
```php
BreezyCore::make()
->myProfile()
->customMyProfilePage(AccountSettingsPage::class),
```
--------------------------------
### Enable Sanctum Personal Access Tokens
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Activate Sanctum token management within Breezy. Optionally, customize the default permissions for token operations.
```php
BreezyCore::make()
->enableSanctumTokens(
permissions: ['my','custom','permissions'] // optional, customize the permissions (default = ["create", "view", "update", "delete"])
)
```
--------------------------------
### Add Breezy to Filament Panel
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Integrate BreezyCore into your Filament Panel by adding it to the plugins array in your PanelProvider.
```php
use Jeffgreco13\FilamentBreezy\BreezyCore;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
BreezyCore::make()
])
}
```
--------------------------------
### Integrate Tailwind Classes
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/UPGRADING.md
Add Breezy's views to your custom Filament V4 theme's theme.css file.
```css
@source '../../../../vendor/jeffgreco13/filament-breezy/resources/**/*';
```
--------------------------------
### Enable Two Factor Authentication
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Configure two-factor authentication settings, including forcing users to enable it, specifying a custom 2FA page, customizing the authentication middleware, and scoping it to the current panel.
```php
BreezyCore::make()
->enableTwoFactorAuthentication(
force: false, // force the user to enable 2FA before they can use the application (default = false)
action: CustomTwoFactorPage::class, // optionally, use a custom 2FA page
authMiddleware: MustTwoFactor::class, // optionally, customize 2FA auth middleware or disable it to register manually by setting false
scopeToPanel: true, // scope the 2FA only to the current panel (default = true)
)
```
--------------------------------
### Password Confirmation Button Action
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Create a button action that prompts for password confirmation before executing a sensitive action. This uses the `password_timeout` setting from `config/auth.php`.
```php
use Jeffgreco13\FilamentBreezy\Actions\PasswordButtonAction;
use Filament\Support\Icons\Heroicon;
PasswordButtonAction::make('secure_action')->action('doSecureAction')
```
```php
// Customize the icon, action, modalHeading and anything else.
PasswordButtonAction::make('secure_action')->label('Delete')->icon(Heroicon::ShieldCheck)->modalHeading('Confirmation')->action(fn() => $this->doAction())
```
--------------------------------
### Create Migration for Avatar URL Column
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Generate a new migration to add the 'avatar_url' column to your users table, which is required for storing user avatars.
```bash
php artisan make:migration add_avatar_url_column_to_users_table
```
--------------------------------
### Update Auth Guard in Filament Panel
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Configure the authentication guard for your Filament Panel to be used by Breezy. Ensure the associated model extends Authenticatable.
```php
use Jeffgreco13\FilamentBreezy\BreezyCore;
class CustomersPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
...
->authGuard('customers')
->plugin(
BreezyCore::make()
)
}
}
```
--------------------------------
### Customize Browser Sessions Component
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Override the default `browser_sessions` component by specifying a custom Livewire component class in the `myProfileComponents` method.
```php
BreezyCore::make()
->myProfileComponents([
'browser_sessions' => \App\Livewire\CustomBrowserSessions::class, // Your custom component
])
```
--------------------------------
### Update Composer Package
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/UPGRADING.md
Update the filament-breezy package to version ^3.0 in your composer.json file.
```json
"jeffgreco13/filament-breezy": "^3.0",
```
--------------------------------
### Extend PersonalInfo Component
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Extend the original PersonalInfo component to customize fields and notifications. Override `getProfileFormComponents` to define custom fields and `sendNotification` for custom success messages.
```php
namespace App\Livewire;
use Filament\Forms;
use Filament\Notifications\Notification;
use Jeffgreco13\FilamentBreezy\Livewire\PersonalInfo;
class CustomPersonalInfo extends PersonalInfo
{
public ?array $only = ['custom_name_field', 'custom_email_field'];
// You can override the default components by returning an array of components.
protected function getProfileFormComponents(): array
{
return [
$this->getNameComponent(),
$this->getEmailComponent(),
$this->getCustomComponent(),
];
}
protected function getNameComponent(): Forms\Components\TextInput
{
return Forms\Components\TextInput::make('custom_name_field')
->required();
}
protected function getEmailComponent(): Forms\Components\TextInput
{
return Forms\Components\TextInput::make('custom_email_field')
->required();
}
protected function sendNotification(): void
{
Notification::make()
->success()
->title('Saved Data!')
->send();
}
}
```
--------------------------------
### Add Avatar URL Column to Users Table Migration
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Define the schema changes in the migration to add a nullable string column named 'avatar_url' to the 'users' table.
```php
string('avatar_url')->nullable();
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('avatar_url');
});
}
};
```
--------------------------------
### Exclude Default My Profile Components
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Prevent specific default My Profile page components from being used by providing their keys to the `withoutMyProfileComponents` helper.
```php
BreezyCore::make()
->withoutMyProfileComponents([
'update_password'
])
```
--------------------------------
### Customize Avatar Upload Component
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Customize the avatar upload component in Filament Breezy. You can modify the existing component or replace it with a custom FileUpload component.
```php
BreezyCore::make()
->avatarUploadComponent(fn($fileUpload) => $fileUpload->disableLabel())
// OR, replace with your own component
->avatarUploadComponent(fn() => FileUpload::make('avatar_url')->disk('profile-photos'))
```
--------------------------------
### Customize Two Factor Authentication Page
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Extend the default `TwoFactorPage` to customize the authentication layout. Specify a custom view for the layout using the static `$layout` property.
```php
use Jeffgreco13\FilamentBreezy\Pages\TwoFactorPage;
class CustomTwoFactorPage extends TwoFactorPage
{
protected static string $layout = 'custom.auth.layout.view';
}
```
--------------------------------
### Add Avatar URL to User Model Fillable Properties
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Include 'avatar_url' in the $fillable array of your User model to allow mass assignment for this attribute.
```php
protected $fillable = [
...
'avatar_url',
...
];
```
--------------------------------
### Update Custom Profile Components
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/UPGRADING.md
Update custom profile components to match the new syntax for Filament V4.
```blade
```
--------------------------------
### Add TwoFactorAuthenticatable Trait
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Include the `TwoFactorAuthenticatable` trait in your User model to enable two-factor authentication.
```php
use Jeffgreco13\FilamentBreezy\Traits\TwoFactorAuthenticatable;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, TwoFactorAuthenticatable;
// ...
}
```
--------------------------------
### Customize Password Update Rules
Source: https://github.com/jacobtims/filament-breezy/blob/3.x/README.md
Configure password validation rules and whether the current password is required for updates. Defaults to Laravel's standard rules and requires the current password.
```php
use Illuminate\Validation\Rules\Password;
BreezyCore::make()
->passwordUpdateRules(
rules: [Password::default()->mixedCase()->uncompromised(3)], // you may pass an array of validation rules as well. (default = ['min:8'])
requiresCurrentPassword: true, // when false, the user can update their password without entering their current password. (default = true)
)
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.