PHP code example of coringawc / filament-tutorials

1. Go to this page and download the library: Download coringawc/filament-tutorials 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/ */

    

coringawc / filament-tutorials example snippets


use CoringaWc\FilamentTutorials\FilamentTutorialsPlugin;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        ->id('app')
        ->plugin(
            FilamentTutorialsPlugin::make()
        );
}



declare(strict_types=1);

namespace App\Filament\App\Tutorials;

use App\Filament\App\Resources\ContractingDraftResource;
use App\Filament\App\Resources\ContractingDraftResource\Pages\ListContractingDrafts;
use CoringaWc\FilamentTutorials\FilamentTutorial;
use CoringaWc\FilamentTutorials\TutorialStep;

final class ContractingListTutorial extends FilamentTutorial
{
    protected static ?string $page = ListContractingDrafts::class;

    /**
     * @param  list<TutorialStep>|null  $steps
     * @return ($steps is null ? list<TutorialStep> : static)
     */
    public function steps(?array $steps = null): array|static
    {
        if ($steps !== null) {
            return parent::steps($steps);
        }

        return [
            TutorialStep::make('contracting-drafts.page-overview')
                ->targetPage(ListContractingDrafts::class)
                ->title(__('Contractings'))
                ->description(__('Review the main information available on this page.')),

            TutorialStep::make('contracting-drafts.navigation-item')
                ->targetNavigation(ContractingDraftResource::class)
                ->beforeOpenSidebar()
                ->title(__('Contractings menu'))
                ->description(__('Use this menu to return to your contractings.')),
        ];
    }
}

TutorialStep::make('contracting-draft-page')
    ->targetPage(ListContractingDrafts::class);

TutorialStep::make('contracting-drafts.page-overview');
TutorialStep::make('contracting-drafts.navigation-item');
TutorialStep::make('contracting-drafts.create-action');
TutorialStep::make('contracting-drafts.title-field');

FilamentTutorial::make('contracting-drafts.list');

use CoringaWc\FilamentTutorials\Contracts\HasFilamentTutorials;
use CoringaWc\FilamentTutorials\FilamentTutorial;
use CoringaWc\FilamentTutorials\TutorialStep;
use Filament\Pages\Page;

final class ListContractingDrafts extends Page implements HasFilamentTutorials
{
    public static function tutorials(): FilamentTutorial
    {
        return FilamentTutorial::make('contracting-drafts.list')
            ->steps([
                TutorialStep::make('contracting-drafts.page-overview')
                    ->targetPage()
                    ->title(__('Contractings'))
                    ->description(__('Review the main information available on this page.')),
            ]);
    }
}

use CoringaWc\FilamentTutorials\FilamentTutorial;
use CoringaWc\FilamentTutorials\FilamentTutorialsPlugin;
use CoringaWc\FilamentTutorials\TutorialStep;

FilamentTutorialsPlugin::make()
    ->tutorials(
        FilamentTutorial::make('contracts-overview')
            ->forPage(ContractsDashboard::class)
            ->steps([
                TutorialStep::make('contracts-overview.page')
                    ->targetPage(ContractsDashboard::class),
            ]),
    );

FilamentTutorialsPlugin::make()
    ->tutorials(ContractingListTutorial::class);

TutorialStep::make('contracting-drafts.page-overview')
    ->targetPage(ListContractingDrafts::class);

TutorialStep::make('contracting-drafts.navigation-item')
    ->targetNavigation(ContractingDraftResource::class);

TutorialStep::make('contracting-drafts.global-search')
    ->targetRenderHook('global-search.before');

TutorialStep::make('contracting-drafts.create-action')
    ->targetAction('create', ListContractingDrafts::class);

TutorialStep::make('contracting-drafts.title-field')
    ->targetComponent('contracting.form.title');

use Filament\View\PanelsRenderHook;

'render_hook_targets' => [
    'global-search.before' => PanelsRenderHook::GLOBAL_SEARCH_BEFORE,
    'page.header.actions.after' => PanelsRenderHook::PAGE_HEADER_ACTIONS_AFTER,
],

TutorialStep::make('contracting-drafts.header-actions')
    ->targetRenderHook('page.header.actions.after');

use CoringaWc\FilamentTutorials\TutorialTargetAttributes;
use Filament\Actions\CreateAction;

CreateAction::make()
    ->extraAttributes(
        TutorialTargetAttributes::action('create', ListContractingDrafts::class)
    );

TutorialStep::make('contracting-drafts.create-action')
    ->targetAction('create', ListContractingDrafts::class);

use CoringaWc\FilamentTutorials\TutorialTargetAttributes;
use Filament\Forms\Components\TextInput;

TextInput::make('title')
    ->extraInputAttributes(
        TutorialTargetAttributes::component('contracting.form.title')
    );

TutorialStep::make('contracting-drafts.title-field')
    ->targetComponent('contracting.form.title');

$attributes = TutorialTargetAttributes::custom('contracting.summary');

TutorialStep::make('contracting-drafts.summary')
    ->target('contracting.summary');

TutorialStep::make('contracting-drafts.navigation-item')
    ->targetNavigation(ContractingDraftResource::class)
    ->beforeOpenSidebar();

TutorialStep::make('contracting-drafts.modal-title-field')
    ->targetComponent('contracting.form.title')
    ->beforeOpenModal([
        'selector' => TutorialTargetAttributes::selector(
            TutorialTargetAttributes::action(
                'create',
                ListContractingDrafts::class,
            ),
        ),
    ]);

TutorialStep::make('contracting-drafts.filters-menu')
    ->target('contracting.filters.menu')
    ->beforeOpenDropdown('[data-tour="contracting.filters.trigger"]');

TutorialStep::make('contracting-drafts.advanced-panel')
    ->target('contracting.advanced.panel')
    ->beforeOpenCollapsible(
        trigger: '[data-tour="contracting.advanced.trigger"]',
        panel: '[data-tour="contracting.advanced.panel"]',
    );

FilamentTutorial::make('first-run-contracting')
    ->forPage(ListContractingDrafts::class)
    ->autoStart()
    ->steps([
        TutorialStep::make('first-run-contracting.page-overview')
            ->targetPage(ListContractingDrafts::class)
            ->title(__('Contractings'))
            ->description(__('Review and create contractings from this page.')),
    ]);

FilamentTutorialsPlugin::make()
    ->dismissalReminder(
        skipLabel: __('Ignore'),
        title: __('You can return whenever you need'),
        description: __('Use the question-mark button to open this guide again.'),
    );

use Filament\Support\Icons\Heroicon;
use Filament\View\PanelsRenderHook;

FilamentTutorialsPlugin::make()
    ->launcher(
        renderHook: PanelsRenderHook::USER_MENU_BEFORE,
        icon: Heroicon::OutlinedQuestionMarkCircle,
        tooltip: __('Open page guide'),
        label: __('Open page guide'),
    );

FilamentTutorialsPlugin::make()
    ->discoverTutorials(
        in: app_path('Filament/App/ProductGuides'),
        for: 'App\\Filament\\App\\ProductGuides',
    );

['web', 'throttle:filament-tutorials-progress']
bash
composer vendor:publish --tag=filament-tutorials-config
php artisan vendor:publish --tag=filament-tutorials-migrations
php artisan migrate
php artisan filament:assets
text
app/Filament/App/Tutorials/ContractingListTutorial.php