1. Go to this page and download the library: Download guava/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/ */
guava / tutorials example snippets
use Guava\Tutorials\TutorialsPlugin;
$panel->plugins([
TutorialsPlugin::make(),
//
])
use Guava\Tutorials\Concerns\InteractsWithTutorials;
use Guava\Tutorials\Contracts\HasTutorials;
use Guava\Tutorials\Steps\Step;
class CreateProject extends CreateRecord implements HasTutorials
{
use InteractsWithTutorials;
public function mount(): void
{
parent::mount();
$this->mountTutorial();
}
public function tutorial(Tutorial $tutorial) : Tutorial
{
return $tutorial->steps([
Step::make('name'),
Step::make('description'),
]);
}
}
$tutorial->steps([
//
])
->afterMount(
fn() => // Your code here
)
$tutorial->steps([
//
])
->afterUnmount(
fn() => // Your code here
)
$tutorial->steps([
//
])
->afterSkipped(
fn() => // Your code here
)
use Guava\Tutorials\Selectors\FormSelector;
use Guava\Tutorials\Selectors\FieldSelector;
use Guava\Tutorials\Selectors\ComponentSelector;
// All variants are the same
Step::make('username');
Step::make(FormSelector::make('username'));
Step::make(FieldSelector::make('username'));
Step::make(ComponentSelector::make('username'));
use Guava\Tutorials\Selectors\WidgetSelector;
// Currently only the "index" of the widget is supported
// So first widget = '1', second widget = '2', etc.
Step::make(WidgetSelector::make('1'));
use \Guava\Tutorials\Selectors\Selector;
Step::make(Selector::make('div'));
Step::make(Selector::make('#my-id'));
Step::make(Selector::make('.my-class'));
Step::make(Selector::make('[data-attribute]'));
Step::make('username')
->label('Enter a username');
Step::make('username')
->hiddenLabel(true); // or a closure
Step::make('username')
->description('Pick an easy-to-remember, unique username');
Step::make('username')
->hiddenDescription(true); // or a closure