PHP code example of devletes / filament-timeline-view
1. Go to this page and download the library: Download devletes/filament-timeline-view 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/ */
devletes / filament-timeline-view example snippets
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();
}
}
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();
}
}
use Filament\Schemas\Components\Livewire;
public function content(Schema $schema): Schema
{
return $schema->components([
Livewire::make(CompanyPulseWidget::class)->columnSpan('full'),
]);
}