kusikusi/forms

Form management form Kusikusi.

v8.0.9 2021-10-25 06:51 UTC

This package is auto-updated.

Last update: 2024-04-13 17:08:25 UTC


README

This is a read-only repository, splitted from the monorepo at github.com/cuatromedios/kusikusi-monorepo

For the Laravel starter kit visit github.com/cuatromedios/kusikusi

Software License Travis Total Downloads

Install

This package complements kusikusi/models and kusikusi/website packages, that should be required first.

composer require kusikusi/forms

Usage

Publish the assets

  • Publish all the assets ...
    php artisan vendor:publish --provider="Kusikusi\FormServiceProvider"
  • Or Publish individual Assets

    Configuration

    php artisan vendor:publish --provider="Kusikusi\FormServiceProvider" --tag="config"

Migrations

php artisan migrate

Receiving forms

  • Any form you want to be processed by Kusikusi Forms, set the action to /form and method to post
  • Include the Laravel CSRF token
  • Include a hidden field named entity_id with the entity id value of the current page
    <form action="/form" method="post">
        <input name="name" />
        <input name="email" type="email" />
        <input type="hidden" name="_token" value="{{ csrf_token() }}" />
        <input type="hidden" name="entity_id" value="{{ $entity->id }}" />
        <button type="submit">Enviar</button>
    </form>
  • The entity referenced should have in the properties field, a property named form with specific params:
    • fields an object with the keys as the field names and values as the validation string for that field, if a field is not described here will be ignored.
    • mail_to an email address if you want to send the entry to an email address. You should have mail values configured in your Laravel project.
    {
      "form": {
        "mail_to": "contact@example.com",
        "fields": {
          "name": {
            "validation": "required|max:50"
          },
          "email": {
            "validation": "required|email"
          }
        }
      }
    }

Routes

This Kusikusi Forms Package, has a routes specific for form entries management

Receiving form entries

POST /form

API endpoints to manage the entries.

GET /formentries/
GET /formentries/{formentry_id}
PATCH GET /formentries/{formentry_id}
DELETE GET /formentries/{formentry_id}

Testing

Run the tests with:

vendor/bin/phpunit

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

Security

If you discover any security-related issues, please email dev@cuatromedios instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.