### Install Filament Timeline View Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Install the package using Composer. No plugin registration is needed as the service provider auto-loads. ```bash composer require devletes/filament-timeline-view ``` -------------------------------- ### Publish Filament Assets Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Publish the package's assets after installation. This command registers the CSS asset with Filament's asset system. ```bash php artisan filament:assets ``` -------------------------------- ### Configure TimelineEntry Card Fields with String Paths Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md This example shows how to configure the fields for a TimelineEntry card using direct string paths for title, content, image, author, and time. These paths are resolved using `data_get` on the record. ```php TimelineEntry::make() ->title('title') ->content('excerpt') ->image('hero_url') ->author('author.name', 'author.avatar_url') ->time('published_at'); ``` -------------------------------- ### Configure TimelineEntry Card Fields with Closures Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md This snippet demonstrates configuring TimelineEntry card fields using closures, allowing for dynamic data retrieval and manipulation. It shows how to process HTML content, get image URLs, and format author and time data. ```php TimelineEntry::make() ->title('title') // dot-notation field path ->content(fn ($record) => strip_tags($record->html_body)) // closure ->image(fn ($record) => $record->cover?->getUrl('thumb')) // closure ->author( 'author.name', // string path fn ($record) => $record->author?->getFilamentAvatarUrl(), // closure ) ->time('published_at') ``` -------------------------------- ### Resource List Page with Single-Sided Timeline Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Example of configuring a Filament resource list page to display data as a single-sided timeline. Uses `TimelineEntry` for columns and `->asTimeline()` macro. ```php use Devletes\FilamentTimelineView\Tables\Columns\TimelineEntry; use Filament\Actions\ActionGroup; use Filament\Actions\ViewAction; use Filament\Actions\EditAction; use Filament\Actions\DeleteAction; use Filament\Tables\Grouping\Group; use Filament\Tables\Table; class ListPulses extends ListRecords { protected static string $resource = PulseResource::class; public function table(Table $table): Table { return $table ->columns([ TimelineEntry::make() ->title('title') ->content('body') ->image('hero_image_url') ->author('author.name', 'author.avatar_url') ->time('published_at'), ]) ->defaultGroup(Group::make('published_at')->date()) ->recordActions([ ActionGroup::make([ ViewAction::make(), EditAction::make(), DeleteAction::make(), ]), ]) ->paginated([10]) ->asTimeline(); } } ``` -------------------------------- ### Override Timeline Theming with CSS Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Customize the timeline's appearance by overriding CSS custom properties. This example shows how to adjust line color for dark mode and container padding. ```css .fi-ta-timeline { /* Override container padding, e.g. flush against the section card. */ padding: 0; } .dark .ftv-shell { --ftv-line-color: oklch(50% 0.04 240); } ``` -------------------------------- ### Configure a Double-Sided Timeline View Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md This snippet illustrates how to switch from a standard timeline to a double-sided timeline by replacing `->asTimeline()` with `->asDoubleSidedTimeline()`. This layout alternates cards per date and collapses on smaller screens. ```php return $table ->columns([TimelineEntry::make()-...]) ->groups([Group::make('published_at')->date()]) ->asDoubleSidedTimeline(); ``` -------------------------------- ### Per-Card Action Group Configuration Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Define actions for individual timeline cards using `recordActions`. The package automatically renders a single kebab dropdown, consolidating provided actions into an `ActionGroup`. ```php ->recordActions([ ActionGroup::make([ ViewAction::make(), EditAction::make()->color('primary'), DeleteAction::make()->requiresConfirmation()->color('danger'), ])->color('gray'), ]) ``` -------------------------------- ### Create a Timeline Widget with Filament Tables Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md This snippet demonstrates how to use the TimelineEntry column within a Filament TableWidget to display a company pulse feed. It configures columns, sorting, grouping, and pagination for a timeline view. ```php use Devletes\FilamentTimelineView\Tables\Columns\TimelineEntry; use Filament\Tables\Grouping\Group; use Filament\Tables\Table; use Filament\Widgets\TableWidget; class CompanyPulseWidget extends TableWidget { protected int|string|array $columnSpan = 'full'; public function table(Table $table): Table { return $table ->heading('Company Pulse') ->description('Latest updates across the company.') ->query(fn () => app(EmployeeDashboardService::class) ->pulseFeedQuery(Filament::auth()->user()) ->with(['author'])) ->defaultSort('published_at', 'desc') ->columns([ TimelineEntry::make() ->title('title') ->content('excerpt') ->image('hero_url') ->author('author.name', 'author.avatar_url') ->time('published_at'), ]) ->defaultGroup(Group::make('published_at')->date()) ->recordActions([ Action::make('view') ->icon('heroicon-m-eye') ->url(fn ($record) => PulsePostResource::getUrl('view', ['record' => $record])), ]) ->paginated([5]) ->asTimeline(); } } ``` -------------------------------- ### Publish Translation Files Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md To customize strings or add new locales, publish the package's translation files using the Artisan command. This makes the language files available for editing. ```bash php artisan vendor:publish --tag=filament-timeline-view-translations ``` -------------------------------- ### Enable 'Load More' Pagination Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Use the `paginated()` method to replace default pagination with a 'Load more' button. Specify the number of records to load per click. ```php ->paginated([5]) ``` -------------------------------- ### Custom Timeline Entry Layout Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Use Stack and Split components to define a custom inner structure for timeline entries when the default TimelineEntry is too opinionated. This allows for flexible arrangement of images and text within each card. ```php use Filament\Tables\Columns\ImageColumn; use Filament\Tables\Columns\Layout\Split; use Filament\Tables\Columns\Layout\Stack; use Filament\Tables\Columns\TextColumn; ->columns([ Stack::make([ Split::make([ ImageColumn::make('cover_url')->circular()->size(60)->grow(false), Stack::make([ TextColumn::make('title')->weight('bold')->size('lg'), TextColumn::make('summary')->color('gray'), Split::make([ TextColumn::make('author.name')->size('xs')->color('gray'), TextColumn::make('published_at')->time()->size('xs')->color('gray')->alignEnd(), ]), ]), ]), ]), ]) ``` -------------------------------- ### Date Grouping with Newest-First Ordering Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Implement newest-first ordering for date-grouped timeline entries by using `orderByDesc` within the `orderQueryUsing` closure on the Group. This ensures chronological order with the most recent items at the top. ```php ->defaultGroup( Group::make('published_at') ->date() ->orderQueryUsing(fn ($query) => $query->orderByDesc('published_at')) ) ``` -------------------------------- ### Embed Timeline Widget in a Custom Dashboard Page Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md This code shows how to embed the previously defined CompanyPulseWidget into a custom Filament dashboard page using Filament's Livewire component. Ensure the widget is correctly imported and referenced. ```php use Filament\Schemas\Components\Livewire; public function content(Schema $schema): Schema { return $schema->components([ Livewire::make(CompanyPulseWidget::class)->columnSpan('full'), ]); } ``` -------------------------------- ### Date Grouping for Timeline Entries Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Configure date-based grouping for timeline entries using Filament's Group API. This displays date headers for 'Today', weekdays, and formatted dates, with options for custom ordering. ```php ->defaultGroup(Group::make('published_at')->date()) ``` -------------------------------- ### Collapsible Day Groups in Timeline Source: https://github.com/devletes/filament-timeline-view/blob/main/README.md Enable collapsible day groups in the timeline by calling `->collapsible()` on the date Group. This adds a toggle to each date header, allowing users to hide/show posts for that day. ```php ->defaultGroup(Group::make('published_at')->date()->collapsible()) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.