Abivia NextForm Generator for Laravel

1.0.2 2020-09-13 03:50 UTC

This package is auto-updated.

Last update: 2020-09-13 07:53:23 UTC


This package integrates NextForm capabilities into a Laravel application.

For a example use in an application, visit https://gitlab.com/abivia/nextform-laravel-demo

The package looks for schema and form definitions in resources/nextform.

The default render engine is Bootstrap4. This can be explicitly set by adding these settings to config/view.php:

    'nextform' => [
        'renderer' => 'Bootstrap4'

Example of loading a schema and populating the data in a controller:

    public function edit($id)
        $test = Test::findOrFail($id);

        return view('tests/edit', compact('test'));

NextForm generates the HTML for the form, but also includes links to required CSS and JS libraries, as well as any form-specific JS. A skeletal layout file might look like this:


<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>NextForm Demo</title>
  <link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css" />
  <div class="container">
  <script src="{{ asset('js/app.js') }}" type="text/js"></script>

The view for the form might look like this:


        'action' => route('tests.update', $test->id),
        'state' => ['_method' => 'PATCH']
    @lang('Update Tests')
    @if ($errors->any())
      <div class="alert alert-danger">
            @foreach ($errors->all() as $error)
              <li>{{ $error }}</li>
      </div><br />
    <?php NextForm::body(); ?>
<?php NextForm::links(); ?>
<?php NextForm::scriptFiles(); ?>
<?php NextForm::script(); ?>