PHP LogoFilament PHP Framework

Filament is a full-stack framework for Laravel that allows developers to rapidly build elegant TALL stack applications (Tailwind CSS, Alpine.js, Livewire, Laravel). It is primarily known for its powerful and beautiful administrative panel builder, but it can also be used to create multi-tenant applications, custom dashboards, and public-facing forms.

Key features of Filament include:
* Resource Builder: Generate complete CRUD (Create, Read, Update, Delete) interfaces for your Eloquent models with minimal code, including forms, tables, and pages.
* Form Builder: A highly flexible and declarative API for building complex forms with various field types (text inputs, selects, rich text editors, file uploads, etc.), validation, and conditional logic.
* Table Builder: Create sortable, searchable, filterable, and paginated data tables with custom columns, actions, and bulk actions.
* Page Builder: Design custom pages and dashboards using Livewire components, integrating seamlessly with the Filament UI.
* Notifications: Built-in system for sending and displaying notifications to users.
* Authentication & Authorization: Integrates with Laravel's built-in authentication and provides robust authorization capabilities using policies and roles.
* Extensible: A plugin-based architecture allows for easy customization and extension of almost every part of the framework.
* Beautiful UI: Comes with a modern, responsive, and accessible user interface powered by Tailwind CSS and Alpine.js.

Filament significantly accelerates the development of backend interfaces, internal tools, CRMs, and CMSs by abstracting away much of the boilerplate code typically associated with such applications. It leverages the power of Livewire to create dynamic and interactive interfaces without writing extensive JavaScript.

Example Code

```php
<?php

namespace App\\Filament\\Resources;

use App\\Filament\\Resources\\PostResource\\Pages;
use App\\Models\\Post;
use Filament\\Forms;
use Filament\\Forms\\Form;
use Filament\\Resources\\Resource;
use Filament\\Tables;
use Filament\\Tables\\Table;
use Illuminate\\Database\\Eloquent\\Builder;
use Illuminate\\Support\\Str;

class PostResource extends Resource
{
    protected static ?string $model = Post::class;

    protected static ?string $navigationIcon = 'heroicon-o-document-text';

    // Define the form for creating and editing posts
    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\\Components\\Section::make('Post Details')
                    ->description('Basic information about the post.')
                    ->schema([
                        Forms\\Components\\TextInput::make('title')
                            ->required()
                            ->maxLength(255)
                            ->live(onBlur: true) // Update slug as title changes
                            ->afterStateUpdated(fn (string $operation, $state, Forms\\Set $set) => $operation === 'create' ? $set('slug', Str::slug($state)) : null),

                        Forms\\Components\\TextInput::make('slug')
                            ->required()
                            ->maxLength(255)
                            ->unique(ignoreRecord: true), // Ensure slug is unique, ignore current record on edit

                        Forms\\Components\\RichEditor::make('content')
                            ->required()
                            ->columnSpanFull(), // Make rich editor take full width

                        Forms\\Components\\Select::make('category_id')
                            ->relationship('category', 'name') // Assumes a Post has a 'category' relationship
                            ->searchable()
                            ->preload()
                            ->createOptionForm([ // Allow creating a new category directly
                                Forms\\Components\\TextInput::make('name')
                                    ->required()
                                    ->maxLength(255),
                            ]),

                        Forms\\Components\\Toggle::make('is_published')
                            ->label('Published')
                            ->helperText('Toggle to make the post visible on the frontend.')
                            ->default(false),
                    ])->columns(2), // Arrange elements in two columns
            ]);
    }

    // Define the table for listing posts
    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\\Columns\\TextColumn::make('title')
                    ->searchable()
                    ->sortable(),

                Tables\\Columns\\TextColumn::make('slug')
                    ->searchable()
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true), // Hidden by default

                Tables\\Columns\\TextColumn::make('category.name') // Display category name
                    ->label('Category')
                    ->searchable()
                    ->sortable(),

                Tables\\Columns\\IconColumn::make('is_published')
                    ->boolean()
                    ->label('Published'),

                Tables\\Columns\\TextColumn::make('created_at')
                    ->dateTime()
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true),

                Tables\\Columns\\TextColumn::make('updated_at')
                    ->dateTime()
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true),
            ])
            ->filters([
                Tables\\Filters\\TernaryFilter::make('is_published')
                    ->label('Published Status')
                    ->boolean()
                    ->trueLabel('Published')
                    ->falseLabel('Draft')
                    ->indicator('Published'), // Text in the filter tag

                Tables\\Filters\\SelectFilter::make('category')
                    ->relationship('category', 'name')
                    ->preload()
                    ->label('Filter by Category'),
            ])
            ->actions([
                Tables\\Actions\\ViewAction::make(),
                Tables\\Actions\\EditAction::make(),
                Tables\\Actions\\DeleteAction::make(),
            ])
            ->bulkActions([
                Tables\\Actions\\BulkActionGroup::make([
                    Tables\\Actions\\DeleteBulkAction::make(),
                ]),
            ]);
    }

    // Define the pages associated with this resource
    public static function getPages(): array
    {
        return [
            'index' => Pages\\ListPosts::route('/'),
            'create' => Pages\\CreatePost::route('/create'),
            'view' => Pages\\ViewPost::route('/{record}'),
            'edit' => Pages\\EditPost::route('/{record}/edit'),
        ];
    }

    // Define global search results
    public static function getGloballySearchableAttributes(): array
    {
        return ['title', 'slug', 'content'];
    }
}
```