1. Go to this page and download the library: Download rolland97/filament-tours 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/ */
rolland97 / filament-tours example snippets
FilamentToursPlugin::make()->tours([
Tour::make('create-request')
->for(CreateRequest::class)
->once()
->steps([
Step::make('#data\\.title')
->title('Give it a name')
->body('Something your team will recognise in a list.'),
Step::make('[data-tour="items"]')
->title('Add your items')
->body('One row per thing you need.')
->side('left'),
]),
])
use Filament\Panel;
use Rolland\FilamentTours\FilamentToursPlugin;
use Rolland\FilamentTours\Step;
use Rolland\FilamentTours\Tour;
public function panel(Panel $panel): Panel
{
return $panel
// …
->plugin(
FilamentToursPlugin::make()->tours([
Tour::make('dashboard-intro')
->for(Dashboard::class)
->once()
->steps([
Step::make('[data-tour="stats"]')
->title('Your numbers')
->body('Updated hourly.'),
]),
]),
);
}
use Rolland\FilamentTours\Actions\StartTourAction;
protected function getHeaderActions(): array
{
return [
StartTourAction::make('dashboard-intro')->label('Show me around'),
];
}
use Rolland\FilamentTours\Contracts\TourState;
class DatabaseTourState implements TourState
{
public function hasSeen(string $tourId): bool
{
return auth()->user()->seen_tours[$tourId] ?? false;
}
public function markSeen(string $tourId): void
{
$user = auth()->user();
$user->seen_tours = [...$user->seen_tours, $tourId => true];
$user->save();
}
}