1. Go to this page and download the library: Download haithammaznai7/form-stepper 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/ */
namespace App\Forms;
use HaithamMaznai\FormStepper\Forms\FormBuilder;
class ContactFormBuilder extends FormBuilder
{
public function formType(): string
{
return 'contact';
}
public function mode(): string
{
return 'stepper';
}
public function startWithSteps(): array
{
return [
[
'key' => 'contact-details',
'priority' => 1,
'
namespace App\Models;
use HaithamMaznai\FormStepper\Contracts\ProvidesFormRequirements;
use Illuminate\Database\Eloquent\Model;
class FormOption extends Model implements ProvidesFormRequirements
{
protected $fillable = ['key', ' public function formOptionKey(): string { return $this->key; }
public function formSteps(): array { return $this->
public function up(): void
{
\Illuminate\Support\Facades\Schema::create('application_form_options', function (
\Illuminate\Database\Schema\Blueprint $table,
): void {
$table->id();
$table->string('key')->unique();
$table->json('ts('application_form_options');
}
use HaithamMaznai\FormStepper\Schema\Input;
use HaithamMaznai\FormStepper\Schema\Step;
use HaithamMaznai\FormStepper\Schema\Requirements;
$name = Input::make('name', attributes: [
'rules' => [',
);
$deliveryRequirements = Requirements::make(
Step::make('contact', [
$name,
Input::make('phone', attributes: ['rules' => ['
public function currentTenant(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Team::class, 'current_tenant_id');
}
namespace App\Models;
use HaithamMaznai\FormStepper\Contracts\TenantForm;
use HaithamMaznai\FormStepper\Models\Form;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
class Team extends Model implements TenantForm
{
/** @return MorphMany<Form, $this> */
public function forms(): MorphMany
{
return $this->morphMany(Form::class, 'tenant');
}
}
// config/form-stepper.php
'admin' => [
'enabled' => true, // routes are off by default
'prefix' => 'form-stepper/admin',
'middleware' => ['web', 'auth'],
'name' => 'form-stepper.admin.',
'gate' => 'manage-form-stepper', // null disables the gate check
'per_page' => 15,
'controllers' => [ /* see step 4 */ ],
],
use Illuminate\Support\Facades\Gate;
Gate::define('manage-form-stepper', fn ($user) => $user->is_admin);
use HaithamMaznai\FormStepper\Models\FormInput;
use HaithamMaznai\FormStepper\Models\FormStepTemplate;
use HaithamMaznai\FormStepper\Schema\Requirements;
use HaithamMaznai\FormStepper\Schema\Step;
$contact = FormStepTemplate::where('key', 'contact')->firstOrFail();
$vehicle = FormInput::where('key', 'vehicle')->firstOrFail();
$inspection->update(['