1. Go to this page and download the library: Download jeffgreco13/filament-breezy 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/ */
jeffgreco13 / filament-breezy example snippets
use Jeffgreco13\FilamentBreezy\BreezyCore;
class CustomersPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
...
->plugin(
BreezyCore::make()
)
}
}
use Jeffgreco13\FilamentBreezy\BreezyCore;
class CustomersPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
...
->authGuard('customers')
->plugin(
BreezyCore::make()
)
}
}
BreezyCore::make()
->myProfile(
shouldRegisterUserMenu: true, // Sets the 'account' link in the panel User Menu (default = true)
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')
)
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 ;
}
}
use Filament\Forms\Components\FileUpload;
BreezyCore::make()
->avatarUploadComponent(fn($fileUpload) => $fileUpload->disableLabel())
// OR, replace with your own component
->avatarUploadComponent(fn() => FileUpload::make('avatar_url')->disk('profile-photos'))
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('avatar_url')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('avatar_url');
});
}
};
protected $fillable = [
...
'avatar_url',
...
];
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'])
use Jeffgreco13\FilamentBreezy\Livewire\MyProfileComponent;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
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(Form $form): Form
{
return $form
->schema([
TextInput::make('my_custom_field')
->
use App\Livewire\MyCustomComponent;
BreezyCore::make()
->myProfileComponents([MyCustomComponent::class])
use App\Livewire\MyCustomComponent;
BreezyCore::make()
->myProfileComponents([
// 'personal_info' => ,
'update_password' => MyCustomComponent::class, // replaces UpdatePassword component with your own.
// 'two_factor_authentication' => ,
// 'sanctum_tokens' =>
])
namespace App\Livewire;
use Filament\Forms;
use Filament\Notifications\Notification;
use Jeffgreco13\FilamentBreezy\PersonalInfo;
class CustomPersonalInfo extends PersonalInfo
{
protected function getNameComponent(): Forms\Components\TextInput
{
return Forms\Components\TextInput::make('custom_name_field')
-> ->send();
}
}
TwoFactorAuthentication::setSort(4);
use Jeffgreco13\FilamentBreezy\Traits\TwoFactorAuthenticatable;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, TwoFactorAuthenticatable;
// ...
}
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
)
use Jeffgreco13\FilamentBreezy\Pages\TwoFactorPage;
class CustomTwoFactorPage extends TwoFactorPage
{
protected static string $layout = 'custom.auth.layout.view';
}
use Jeffgreco13\FilamentBreezy\Actions\PasswordButtonAction;
PasswordButtonAction::make('secure_action')->action('doSecureAction')
// Customize the icon, action, modalHeading and anything else.
PasswordButtonAction::make('secure_action')->label('Delete')->icon('heroicon-s-shield-check')->modalHeading('Confirmation')->action(fn()=>$this->doAction())