PHP code example of hasan-ahani / filament-otp-input
1. Go to this page and download the library: Download hasan-ahani/filament-otp-input 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/ */
hasan-ahani / filament-otp-input example snippets
use HasanAhani\FilamentOtpInput\Components;
use Filament\Forms\Form;
public function form(Form $form): Form
{
return $form
->schema([
// ...
OtpInput::make('otp')
->label('Otp'),
]);
}
use HasanAhani\FilamentOtpInput\Components;
use Filament\Forms\Form;
public function form(Form $form): Form
{
return $form
->schema([
// ...
OtpInput::make('otp')
->numberInput(6)
->label('Otp'),
]);
}
use HasanAhani\FilamentOtpInput\Components;
use Filament\Forms\Form;
public function form(Form $form): Form
{
return $form
->schema([
// ...
OtpInput::make('otp')
->numberInput(8)
->afterStateUpdated(function (string $state){
dd($state);
// submit form or save record
})
->label('Otp'),
]);
}
use HasanAhani\FilamentOtpInput\Components;
use Filament\Forms\Form;
public function form(Form $form): Form
{
return $form
->schema([
// ...
OtpInput::make('otp')
->password()
// or
->text()
->label('Otp'),
]);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.