Git Product home page Git Product logo

laraform's Introduction

Dynamic Form Builder for Laravel with Vue.js

Create even the most complex forms with ease, using two-sided validation,
eloquent, nested elements, conditional logic, wizards and many more.

Laraform Community Edition (Vue.js)

Laraform is a premium library aiming to become the world's best form builder tool for web developers. It enhances collaboration by standardizing the creation of forms and increases efficiency by eliminating tons of repetitive work. Laraform comes with a lighter "Community Edition" and a full version which can be purchased at our website.

Features

Full features of Laraform:

  • Two-sided validation
  • 54 Laravel compatible frontend validators
  • Eloquent ORM support
  • Multiple file uploads
  • 34+ built-in elements
  • Nested elements
  • Repeatable elements
  • Translatable elements
  • Conditional logic
  • Form wizard
  • Localization
  • Theming
  • Extensibility

Examples

Browser Support

Laraform aims to support the latest versions of:

  • Google Chrome
  • Firefox
  • Apple Safari
  • Microsoft Edge
  • Opera
  • Safari iOS
  • Chrome, Firefox and Default Browser Android

Installation

Laraform is a full-stack library which comes with a separate frontend and backend library. This will install Laraform's Community Edition. For the full package please check out our website.

Install frontend library for Vue.js:

npm i laraform --save

Make sure you have the following peer dependencies installed:

npm i axios lodash moment vue --save

Install backend library for Laravel:

composer require laraform/laraform-laravel

Publish assets:

php artisan vendor:publish

When asked, choose: Laraform\LaraformServiceProvider. This will publish a config file at config/laraform.php.

Usage

Create a form at app\Forms\FirstForm.php:

<?php

namespace App\Forms;

class FirstForm extends \Laraform
{
  public function schema() {
    return [
      'hello_world' => [
        'type' => 'text',
        'label' => 'Hello',
        'default' => 'World'
      ]
    ];
  }
}

Pass the form to view in routes/web.php using app() function:

Route::get('/', function () {
  return view('welcome', [
    'form' => app('App\Forms\FirstForm')
  ]);
});

Set up rendering in view in resources/views/welcome.blade.php:

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>Laravel</title>

    <link rel="stylesheet" type="text/css" href="/css/app.css">
  </head>
  <body>
    <div id="app">
      {!! $form->render() !!}
    </div>

    <script src="/js/app.js"></script>
  </body>
</html>

Include Laraform in resources/js/app.js:

require('./bootstrap');

import Vue from 'vue'
import Laraform from 'laraform'

Vue.use(Laraform)

const app = new Vue({
  el: '#app',
})

Import theme in resources/sass/app.scss:

@import 'laraform/src/themes/default/scss/theme.scss';

If you are planning to use a CSS framework, like Bootstrap, make sure you include its theme file before Laraform's theme, so that Laraform can make use of the CSS framework's variables.

This is how it should look like in case of Bootstrap 4:

// Bootstrap 4's main theme file
@import 'bootstrap/scss/bootstrap';

// Laraform's theme file created for Bootstrap 4
@import 'laraform/src/themes/bs4/scss/theme.scss';

Laraform currently support Bootstrap 3 and Bootstrap 4. If you are using one of those also make sure to change the global theme in config/laraform.php to bs3 or bs4:

// ...
'theme' => 'bs4',

// ...

Compile your assets with:

npm run dev

Launch your site for example with:

php artisan serve

Now if you load the site you should see a very simple form with one single input. Check out our docs to learn how to create more advanced forms.

You can also download Examples to see more forms in action.

Feature Comparison

Full Version Community Edition
Backend support
Elements all checkbox, checkbox group, hidden, key, meta,
multiselect (native), password, radio, radio group, static,
textarea, text
File uploads -
Nested elements -
Custom elements
Translatable elements -
Localization
Custom locales
Validation
Validation rules all accepted, alpha, alpha_dash, alpha_num, between,
boolean, digits, digits_between, email, filled, in,
integer, ip, ipv4, ipv6, json, max, min, not_in, not_regex,
numeric, regex, required, size, string, timezone, url, uuid
Custom rules
Conditions -
Tabs -
Wizard -
Events & hooks
Buttons
Themes all all
Custom themes -
Custom styles
Custom layout
Code splitting -
Get Full version Try out Community Edition

Documentation

A complete Developer Guide and API Reference is available at Laraform website.

Issue Tracking

Laraform uses GitHub Issues for official bug tracking. Please follow our issue template to help us hunt down bugs as efficiently as possible.

Support & Contribution

If you have any questions about Laraform or interested in contributing, please drop us a line at [email protected]. We are happy for receiving feedbacks as well as growing our enthusiastic developer team.

License

Laraform Community Edition comes with an GPL license so you are free to use this library in your projects. For the full version check out the license at our website.

Vueform

If you are looking for a form builder library that specifically focuses on Vue.js, check out vueform.com.

laraform's People

Contributors

adamberecz avatar laraform avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laraform's Issues

Exception "Attribute value must be an array or instance of Countable"

I have the following list defined in a form;

        '_props->notes' => [
            'type' => 'list',
            'label' => 'Notes',
            'object' => [
                        'label' => 'Entry',
                        'schema' => [
                                'note' => [
                                    'label' => 'Note',
                                    'type' => 'textarea',
                                ],
                                'ts' => [
                                    'label' => 'TS',
                                    'type' => 'text',
                                    'columns' => 6
                                ],
                                'uid' => [
                                    'label' => 'UID',
                                    'type' => 'text',
                                    'columns' => 6
                                ]
                            ],
                        ]
        ]

When I submit, the data gets saved but the /laraform/process returns with an an http error 500 and the following error message;

exception: "UnexpectedValueException"
file: {...}\vendor\laraform\laraform-laravel\src\Elements\ListObjectElement.php"
line: 32
message: "Attribute value must be an array or instance of Countable"

As I was saying data gets saved just fine...Thoughts ?

Toggle element is always on

Hi, it seems the toggle element is always rendered as "ON". The data is saved correctly at the database but it seems the switch is set "OFF" if the value is "null".

I tried different "falseValue" such as 0, false, off, etc but they all have the same behaviour.

Any ideas?

Object Element gives array_merge(): Expected parameter 2 to be an array, null given

So after applying the fixes at #9 I am getting the following error:

{message: "array_merge(): Expected parameter 2 to be an array, null given",…}
exception: "ErrorException"
file: "vendor/laraform/laraform-laravel/src/Elements/ObjectElement.php"
line: 89
message: "array_merge(): Expected parameter 2 to be an array, null given"

This is my Form class

class Company extends Laraform
{

	public $primaryKey = 'guid';
	public $component = 'form-generic';
	public $model = \App\Obj::class;
	public $tabs = [
			'company_info' =>[
				'label' => 'Basic Info',
				'elements' => ['name', '_props->email', '_props->address', '_props->phone', '_props->fax', 'status' ]
			],
			'business_info' => [
				'label' => 'Business Info',
				'elements' => ['_props->avatar', '_props->storefrontname', '_props->brands', '_props->website', '_props->region', 'manager', 'owner', 'storehours']
			]
		];

    public function schema() {

        return [
            'guid' => [
                'type' => 'key'
			],
			'otype' => [
                'type' => 'hidden',
                'default' => 'dealer',
                'attribute' => 'type'
            ],
			'name' => [
                'type' => 'text',
				'label' => 'Company Name',
				'columns' => 6,
				'rules' => 'required'
			],
			'_props->email' => [
                'name' => 'email',
                'type' => 'text',
                'label' => 'Email',
                'columns' => 6,
                'debounce' => 300,
                'rules' => 'required|email',
			],
			'_props->avatar' => [
				'type' => 'avatar',
				'label' => 'Company Logo',
			],
			'_props->storefrontname' => [
                'type' => 'text',
				'label' => 'Store Front Name',
				'columns' => 6,
			],
            '_props->address' => [
                'type' => 'address',
                'class' => 'address'
			],
			'_props->phone' => [
                'type' => 'text',
				'label' => 'Phone',
				'class' => 'phone',
				'columns' => 6
			],
			'_props->fax' => [
                'type' => 'text',
				'label' => 'Fax',
				'class' => 'phone',
				'columns' => 6
            ],
            '_props->brands' => [
				'type' => 'select',
				'label' => 'Brands',
				'items' => config('_app.brands'),
				'search' => true,
				'columns' => 6
			],
			'_props->region' => [
				'type' => 'select',
				'label' => 'Region',
				'items' => config('_app.regions'),
				'columns' => 6
			],
			'_props->website' => [
                'type' => 'text',
				'label' => 'Website',
				'rules' => 'nullable|url',
				'columns' => 6
			],
			'manager' => [
				'type' => 'group',
				'label' => 'Manager',
				'schema' => [
					'_props->manager->name' => [
						'type' => 'text',
						'label' => 'Name',
						'columns' => 6
					],
					'_props->manager->email' => [
						'name' => 'email',
						'type' => 'text',
						'label' => 'Email',
						'columns' => 6,
						'debounce' => 300,
						'rules' => 'nullable|email'
					]
				]
			],
			'owner' => [
				'type' => 'group',
				'label' => 'Owner',
				'schema' => [
					'_props->owner->name' => [
						'type' => 'text',
						'label' => 'Name',
						'columns' => 6
					],
					'_props->owner->email' => [
						'name' => 'email',
						'type' => 'text',
						'label' => 'Email',
						'columns' => 6,
						'debounce' => 300,
						'rules' => 'nullable|email'
					]
				]
			],
			'storehours' => [
                'type' => 'group',
				'label' => 'Store Hours',
				'schema' => [
					'_props->hours' => [
						'type' => 'object',
						'schema' => [
							'monday' => [
								'type' => 'object',
								'label' => 'Monday',
								'schema' => [
									'from' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("08:00 am").format("hh:mm a")',
										'columns' => 6
									],
									'to' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("05:00 pm").format("hh:mm a")',
										'columns' => 6
									],
								]
							],
							'tuesday' => [
								'type' => 'object',
								'label' => 'Tuesday',
								'schema' => [
									'from' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("08:00 am").format("hh:mm a")',
										'columns' => 6
									],
									'to' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("05:00 pm").format("hh:mm a")',
										'columns' => 6
									],
								]
							],
							'wednesday' => [
								'type' => 'object',
								'label' => 'Wednesday',
								'schema' => [
									'from' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("08:00 am").format("hh:mm a")',
										'columns' => 6
									],
									'to' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("05:00 pm").format("hh:mm a")',
										'columns' => 6
									],
								]
							],
							'thursday' => [
								'type' => 'object',
								'label' => 'Thursday',
								'schema' => [
									'from' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("08:00 am").format("hh:mm a")',
										'columns' => 6
									],
									'to' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("05:00 pm").format("hh:mm a")',
										'columns' => 6
									],
								]
							],
							'Friday' => [
								'type' => 'object',
								'label' => 'Friday',
								'schema' => [
									'from' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("08:00 am").format("hh:mm a")',
										'columns' => 6
									],
									'to' => [
										'type' => 'time',
										'hour24' => false,
										'format' => 'h:i K',
										//'default' => 'moment("05:00 pm").format("hh:mm a")',
										'columns' => 6
									],
								]
							],
						],
					],					
				],
			],
			'status' => [
                'type' => 'toggle',
                'falseValue' => null,
                'trueValue' => 'active',
                'text' => 'Active?'
            ]
        ];
    }

[IDEA] min and max for List

Prerequisites

  • [x ] You've described your idea in a clean format with example.

Versions

Description

It would be very useful if it were possible to regulate the amount of repetitions allowed. Something like this:

Example

        'appointment_suggesstions' => [
            "type" => "list",
            "label" => "Suggest an Appointment",
            "initial" => 1,
            "min" => 1,
            "max" => 3
             ...
             ]

Additional Information

Enable/disable remove and add button respectively.

[BUG] Unique validation error

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.3.11
  • Laravel version: 6.6.0
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

Can't validate trough Laraform default unique validation.

Steps to Reproduce

// MyForm.php
public $schema = [
    'id' => [
        'type' => 'key'
    ],
    'name' => [
        'type' => 'text',
        'label' => 'Name',
        'rules' => 'required'
    ],
    'email' => [
        'type' => 'text',
        'label' => 'Email',
        'rules' => 'required|email|unique:users,email',
    ],
    'password' => [
        'type' => 'password',
        'label' => 'Password',
        'rules' => 'required'
    ]
];

Expected behavior:

Should return error message from unique validation

The Email has already been taken.

Or nothing if email address isn't registered yet.

Actual behavior:

Console returns an error from backend:

exception: "ErrorException"
file: "/var/www/vendor/laraform/laraform-laravel/src/Controllers/ValidatorController.php"
line: 21
message: "Undefined index: attributes"

Additional Information

// src/Controllers/ValidatorContoller.php
// line: 21
dd( $request->all() );

// returns
array (
  'params' => 
  array (
    0 => 'users',
    1 => '[email protected]',
  ),
  'value' => '[email protected]',
)

URL File Uploads does not get saved to database

First of all, Laraform is a cool product!

When trying to upload a file (or image or avatar) with the default Laraform component, the URL does not get saved to the database. The actual file, however, does get uploaded to the local disk. When checking the console after submitting the form, the server responds with status 500 and the following error:

exception: "Symfony\Component\Debug\Exception\FatalThrowableError"
file: "/Users/vincent/Code/forms/vendor/laraform/laraform-laravel/src/Database/Handler.php"
line: 158
message: "Call to a member function save() on null"

Since I encountered this problem before, I retried it in a default Laravel project. No modifications, nothing special, just the out of the box setup. Am I missing something obvious here, or would you happen to know what's going on here? The used endpoint for the form processing is also the default /laraform/process.

Thanks, Vincent

Your environment

  • Browser name and version: Chrome 78.0.3904.108
  • Operating System: macOS 10.15.1

Tailwind CSS Theme Support

I'm trying to use this in a current project and was wondering if you have a theme that supports Tailwind CSS rather BS4?
Looking for a solution so I don't have to manually create it all.

Events and Custom Submit ignored

Description

Tell us what happens and what should happen
I am trying to add a submit event hook as well write a custom submit logic as per doc https://laraform.io/docs/events-and-hooks and https://laraform.io/docs/submission#custom-submission-logic. But when custom submit handler just ignored, any event when attached throws error.
I have a licensed full version and developing a PWA with stored schema. Everything else ( render, validation, submit to backend etc) works just fine

Steps to reproduce

Provide steps to reproduce this issue

  1. Use Vue Cli and PWA setup
  2. yarn serve

Demo

Provide a link to a screencast showing the issue
Screenshot (2)
Screenshot (3)
Screenshot (4)
Screenshot (5)

Your environment

  • Browser name and version: Chrome Version 78.0.3904.108 (Official Build) (64-bit)

  • Operating System: Windows 10 Home

[BUG] Problem with conditional validation of uploads

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.3.12
  • Laravel version: 6.6.0
  • Laraform Vue package version: 1.1.7
  • Laraform Laravel package version: 1.1.6

Description

My form has an image field that is required. It also has a condition that the image field is only shown when the 'Photo Required' toggle is true. However, when the condition is false (the 'Photo Required' toggle is set to false), the image field is hidden on the form, but generates an error when submitting the form to the database:

exception: "ErrorException"
file: "/Users/vincent/Code/esbforms/vendor/laraform/laraform-laravel/src/Elements/FileElement.php"
line: 280
message: "Undefined index: photo"

I also tried to add a conditional rule to the image field, but this didn't change the outcome and generated the same error.

Steps to Reproduce

Expected behavior:

The image field should be ignored by the FileElement handler when it's render condition is false.

Actual behavior:

Laraform's FileElement handler tries to upload a file based on an index that's undefined, because it is left out of the form submit due to the condition of the field (at least, that's what I think).

Additional Information

Migration

$table->bigIncrements('id');
$table->string('name');
$table->boolean('photo_required')->default(0);
$table->string('photo')->nullable();
$table->timestamps();

Model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class TestForm extends Model
{
    protected $guarded = [''];
}

Form Class

<?php

namespace App\Forms;

use Laraform;

class TestForm extends Laraform
{
    public $endpoint = '/laraform/process';

    public $model = \App\TestForm::class;

    public $schema = [
        'name' => [
            'type' => 'text',
            'label' => 'Name',
            'rules' => 'required'
        ],
        'photo_required' => [
            'type' => 'toggle',
            'label' => 'Photo Required?',
        ],
        'photo' => [
            'type' => 'image',
            'label' => 'Photo',
            'rules' => 'required',
            'conditions' => [
                0 => ['photo_required', true]
            ]
        ]
    ];

    public $buttons = [
        0 => [
            'label' => 'Submit',
            'class' => 'btn-primary'
        ]
    ];
}

[QUESTION] Binding Vue attributes/form events with Laravel rendering?

  • You've read the documentation and couldn't find an answer.
  • Your question isn't already asked before.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.4.1
  • Laravel version: 6.9.0
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

First, we're loving LaraForm, and have a paid version. :)

Question is how to get the v-bind, v-on:my-event="triggerEvent", etc attributes added to the LaraForm component when using backend style rendering with $myForm->render() ?

Additional Information

I figure we're just missing an obvious setting -- but for now are working around it by overriding render() in our Laravel Form classes, a lot like this -- simplified/compacted for brevity:

// MyForm.php

public $attributes = [
    'v-bind:settings="settings"',
    'v-on:my-event="triggerEvent"',
];

public function render()
    {
    $model = $this->storePath ? "store-path=\"{$this->storePath}\"" : '';
    $form = ":form=\"{$this->toProp()}\"";
    $attributes = implode(' ', $this->attributes);

    return "<{$this->getComponent()} $form $model $attributes></{$this->getComponent()}>";
    }

[BUG] Call to undefined method Illuminate\Support\Facades\Auth::extend()

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: PHP 7.2.24
  • Laravel version: v6.9.0
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

When latest version of Passport is installed this error occurs. Downgrading passport to less then 8.0 (7.5.1 works) resolved this issue.

Steps to Reproduce

Install Laravel with Latest Passport and Laraform Pro Package
Install and compile laraform into app.js
Build a form and try load page

Expected behavior:

The form should load

Actual behavior:

Error Output:

Symfony\Component\Debug\Exception\FatalThrowableError
Call to undefined method Illuminate\Support\Facades\Auth::extend()

[QUESTION] - Hide or Disable Form On Submit

Prerequisites

  • You've read the documentation and couldn't find an answer.
  • Your question isn't already asked before.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.2
  • Laravel version: 6.6
  • Laraform Vue package version: 1.1.8 (Pro)
  • Laraform Laravel package version: 1.1.8 (Pro)

Description

When my form is submitted, I would like to replace the form with a Spinner or shad the fields and maybe display a text.

1.) When a form gets submitted, is there a way to either "shade" the entire form or form each form fields, until a response event is received?

2.) Display a "Spinner" on submission, could be any one of these.
1.) Could be on the button
2.) Above/Below form
3.) Replaces the Form

Additional Information

Not Right now

[BUG] Unique rule frontend validation

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.3.3
  • Laravel version: 6.9.0
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

When defining a unique rule for an input with name "email" like this: "unique:user_invites,email", the request made by the frontend to the unique validation endpoint is this:
['params' => ['users', FILLED_EMAIL_VALUE], 'value' => FILLED_EMAIL_VALUE]

I would expect the request to be:
['params' => ['users', 'email'], 'value' => FILLED_EMAIL_VALUE]

Steps to Reproduce

Make a form extending Laraform and include an input in the schema with a 'unique' rule. When you type in this input and wait for the ajax request to be sent, you will see that the request params are changed when sent back to the backend.

Expected behavior:

Request to unique validator should be:
['params' => ['users', 'email'], 'value' => FILLED_EMAIL_VALUE]

Actual behavior:

Request to unique validator is:
['params' => ['users', FILLED_EMAIL_VALUE], 'value' => FILLED_EMAIL_VALUE]

Additional Information

It seems like the frontend fills every parameter defined in the 'unique' rule with a Vue data property.

I have read #22, but this seems to be a seperate issue.

[DOCS] Examples produce errors

Prerequisites

  • [ x] You've provided enough information to spot the issue.
  • [x ] You filled in the entire issue template.

Versions

Description

SimpleLoginForm.php
public function buttons() { return [[ "label": "Login", "class": "btn-primary" ]]; }

":" should be "=>"

SimpleLoginForm.php
"title" => [ "type" => "html", "html" => "<h5>Log in to your account</h5>" ],

Produced an error on my side, sth. about not existing.

login.blade.php
{{ $loginForm->render() }}

Should be {!! !!}?

Additional Information

Found at https://laraform.io/examples
Using premium versions "@laraform/laraform": "^1.1.10", "laraform/laraform-laravel": "^1.1", on laravel 6

[QUESTION] - Dynamic Lists

Prerequisites

  • You've read the documentation and couldn't find an answer.
  • Your question isn't already asked before.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.2.24
  • Laravel version: Latest
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

Is it possible to provide the "item" options to a dropdown/checkbox from a controller?

The project I am using Laraform with calls to a 3rd party API, and included in the response is a list of dropdown/checkbox options.

Now, this list may be different on each call, so I would want to load the items array from a controller and load the form from the blade template using the render command.

Additional Information

[QUESTION] Manually Setting Errors

Prerequisites

  • You've read the documentation and couldn't find an answer.
  • Your question isn't already asked before.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.2.24
  • Laravel version: 6.12
  • Laraform Vue package version and type: 1.1.9 Pro
  • Laraform Laravel package version: 1.1.10 Pro

Description

In my custom component I have a custom form layout. When I submit the form to the server, I am trying to get the fields to display the errors returned from the post, rather then display the errors above the form, like in the image below. I do not see in the docs anywhere that explains how to do this.

Additional Information

Here is an image of my form.
https://prnt.sc/qr301t

I just want to be able to set each fields error if contained in the response from the server.

[BUG] Extending the default theme gives a trix error

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.3.8
  • Laravel version: 6.6.1
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

When trying to create a custom theme that extends the default theme, there's an error referring to trix.

Steps to Reproduce

My theme file, themes/tailwind.js:

import utils from '@laraform/laraform/src/utils'
import defaultTheme from '@laraform/laraform/src/themes/default'

export default utils.extendTheme(defaultTheme, {
  classes: {},
  elements: {},
  components: {},
  layouts: {},
  grid: {},
})

app.js

import Tailwind from './themes/tailwind'

Laraform.theme('tailwind', Tailwind)

Laraform.config({
  theme: 'tailwind',

  endpoints: {
    process: '/laraform/process',

    // Only required for full version
    elements: {
      trix: {
        attachment: '/laraform/trix-attachment'
      }
    },
    validators: {
      active_url: '/laraform/validator/active_url',
      exists: '/laraform/validator/exists',
      unique: '/laraform/validator/unique',
    },
  }
})

Vue.use(Laraform)

Expected behavior:

The theme will compile successfully with all the appropriate elements.

Actual behavior:

The app does not render and the console shows:

app.js:77732 Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "trix-toolbar" has already been used with this registry
    at http://localhost:8080//js/app.js:77732:28411
    at Object../node_modules/trix/dist/trix.js.e.registerElement (http://localhost:8080//js/app.js:77732:26899)
    at Object.<anonymous> (http://localhost:8080//js/app.js:77733:13468)
    at Object.<anonymous> (http://localhost:8080//js/app.js:77733:13887)
    at Object.<anonymous> (http://localhost:8080//js/app.js:77738:25376)
    at Object.<anonymous> (http://localhost:8080//js/app.js:77742:103)
    at Object../node_modules/trix/dist/trix.js (http://localhost:8080//js/app.js:77743:30)
    at __webpack_require__ (http://localhost:8080//js/app.js:770:30)
    at fn (http://localhost:8080//js/app.js:130:20)
    at Module../node_modules/vue-loader/lib/index.js?!./node_modules/@laraform/laraform/src/components/wrappers/Trix.vue?vue&type=script&lang=js& (http://localhost:8080//js/app.js:87383:62)

Additional Information

None

Vue warning on TimeElement

Hi I am getting the following Vue warning when using the TimeElement

vue.common.dev.js?4650:630 [Vue warn]: Method "disable" has already been defined as a data property.

found in

---> <TimeElement> at node_modules/@laraform/laraform/src/themes/default/components/elements/TimeElement.vue
       <MultiElementLayout> at node_modules/@laraform/laraform/src/themes/default/components/NestedElementLayout.vue
         <ObjectElement> at node_modules/@laraform/laraform/src/themes/default/components/elements/ObjectElement.vue
           <MultiElementLayout> at node_modules/@laraform/laraform/src/themes/default/components/NestedElementLayout.vue
             <ObjectElement> at node_modules/@laraform/laraform/src/themes/default/components/elements/ObjectElement.vue
               <MultiElementLayout> at node_modules/@laraform/laraform/src/themes/default/components/NestedElementLayout.vue
                 <GroupElement> at node_modules/@laraform/laraform/src/themes/default/components/elements/GroupElement.vue
                   <FormElements> at node_modules/@laraform/laraform/src/themes/bs3/components/FormElements.vue
                     <FormGeneric> at resources/js/components/forms/FormGeneric.vue
                       <Root>

Any ideas?

[BUG] Error when updating a model that has a list

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.3.11
  • Laravel version: 6.6.0
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.7

Description

Can't update a model with relation through Laraform with list of objects.

Steps to Reproduce

Laravel's User migration:

Schema::create('users', function (Blueprint $table) {
    $table->bigIncrements('id');
    $table->string('name');
    $table->string('email')->unique();
    $table->timestamp('email_verified_at')->nullable();
    $table->string('password');
    $table->rememberToken();
    $table->timestamps();
});

User model

// app/User.php

// relation to Contact model
public function contacts()
{
    return $this->hasMany(Contact::class);
}

Contacts model migration:

Schema::create('contacts', function (Blueprint $table) {
    $table->bigIncrements('id');

    $table->unsignedBigInteger('user_id');
    $table->string('type')->nullable();
    $table->string('label')->nullable();
    $table->string('value')->nullable();

    $table->foreign('user_id')
        ->references('id')
        ->on('users')
        ->onUpdate('cascade')
        ->onDelete('cascade');

    $table->timestamps();
});

Form

<?php

namespace App\Forms;

use Laraform;
use App\User;

class IssueForm extends Laraform
{
    public $model = User::class;

    public $buttons = [
        [
            'label' => 'Save',
            'class' => 'btn-info',
        ]
    ];

    public $schema = [
        'id' => [
            'type' => 'key'
        ],
        'name' => [
            'type' => 'text',
            'label' => 'Name',
            'rules' => 'required'
        ],
        'email' => [
            'type' => 'text',
            'label' => 'Email',
            'rules' => 'required'
        ],
        'password' => [
            'type' => 'password',
            'label' => 'Password',
            'rules' => 'required'
        ],
        'contacts' => [
            'type' => 'list',
            'label' => 'Contacts',
            'object' => [
                'schema' => [
                    'type' => [
                        'type' => 'select',
                        'label' => 'Type',
                        'placeholder' => '-- select one --',
                        'items' => [
                            'phone' => 'Phone',
                            'email' => 'Email'
                        ],
                        'rules' => 'required'
                    ],
                    'label' => [
                        'type' => 'text',
                        'label' => 'Label',
                        'description' => 'ex.: Friends phone',
                        'rules' => 'required'
                    ],
                    'value' => [
                        'type' => 'text',
                        'label' => 'Phone',
                        'rules' => 'required'
                    ]
                ]
            ]
        ]
    ];

    public function after()
    {
        response()->json([
            "status" => "success",
            "messages" => ["Saved!"]
        ])->send();
    }
}

Route

Route::get('/form', function () {
    $form = app('App\Forms\IssueForm');

    $user = App\User::with('contacts')->where('id',4)->first();
    $form->setData($user->toArray());
    
    return view('form',[
        'form' => $form,
    ]);
});

View

// resources/views/for.blade.php

@extends('layouts.app')

@section('content')
    <div class="container">
        <h1>ok</h1>
        <div class="row justify-content-center">
            <div class="col-md-6">
                <div class="card card-body">
                    {!! $form->render() !!}
                </div>
            </div>
        </div>
    </div>
@endsection

Expected behavior:

It's expected to update the model along with the relation.

Actual behavior:
When updating a model with a list, it trows the following error:

POST http://localhost:8000/laraform/process 500 (Internal Server Error)

exception: "UnexpectedValueException"
file: "/var/www/vendor/laraform/laraform-laravel/src/Elements/ListElement.php"
line: 138
message: "Attribute value must be an array, object given"

Additional Information

Modifying the source code solved the problem:

// src/Elements/ListElement.php
// line: 134
--  $originalCollection = $entity->{$this->attribute} ?? [];
++  $originalCollection = json_decode($entity->{$this->attribute},true) ?? [];

List, not showing default values

I am defining a form in the backend, following the documentation I have

        '_props->todo'=> [
            'type'=> 'list',
            'label'=> 'To-do',
            'element'=> [
              'type'=> 'text',
              'placeholder'=> 'Write here...'
            ],
            'default'=> [
              'Write docs',
              'Create unit tests',
              'Set up npm',
            ]
        ]

as part of the array to be returned by the schema() function.

The control gets draw in the screen, but empty, that is the default values are not shown.

Any idea ?

Web interface for creating forms

Feature request

If I would like a (web) user to be able to create a form themselves, do you have any boilerplate code on how to build a Laravel web interface for this?

E.g like what form.io provides as a “drag-and-drop form builder” is what I am also looking for.

Or should I have to build the logic for such a web interface myself, that effectively generates the schema data needed for your forms?

(PS I’m willing to pay for such a feature)

[IDEA] Allow use of named routes for Form $endpoint

Versions

  • PHP version: 7.3.9
  • Laravel version: 6.6.2
  • Laraform Vue package version: 1.0.5
  • Laraform Laravel package version: 1.0.4

Description

Currently the endpoint needs to be specified as a string making this brittle if the route URLs are changed. If would be useful to have a setEndpoint method on the Forms class allowing us to use the route methods to return the URL string such as route('some.route.name)

[BUG] Datetime picker switching days and months on submission when using english date format

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration - all with full class).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.4.0
  • Laravel version: 6.2.1
  • Laraform Vue package version and type: 1.1.8 pro
  • Laraform Laravel package version: not used

Description

Datetime picker switching the day and month attribute upon submission

Steps to Reproduce

Using only the javascript package. Create a Form:

    export default {
        name: "App",
        mixins: [Laraform],

        data() {
            return {
                schema: {
                    datetime: {
                        type: "datetime",
                        label: "Start Date",
                        default: '01.06.2020 16:00',
                        format: "d.m.Y H:i",
                        dataFormat: "DD.MM.YYYY HH:mm",
                    }
                },
                buttons: [
                    {
                        label: "Save",
                        class: "btn btn-primary",
                        onClick() {
                            return this.form$.submit();
                        }
                    }
                ]
            }
        }
    }

Open console -> network
Click on submit

Expected behavior:
Request data should be 01.06.2020 16:00

Actual behavior:
Request data is: 06.01.2020 16:00

image

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

[QUESTION] What's the status of this project?

Hey there @laraform!

First of all, thank you for producing such a time saving and awesome package. I'm excited by the prospect of Laraform. Having played around with the community edition, it feels like a solid solution and I'm excited by the potential of it. However, looking at the slower github activity in the last few months, and seeing as how the project seems to be primarily run by a single person, I am curious to know what the project's status is looking like.

We are about to embark on a fairly serious rewrite of some of our forms for one of our clients, and I'd love to use Laraform to do this. However, I do worry about the longer term maintainability (or lack thereof) with this project. I'm trying to keep an open mind and fully know and understand how sometimes these things just don't work out. I mean no disrespect and no hate, just wanting to know where this project is in terms of production readyness and commercial viablity before we put all our eggs into this basket.

Thanks a bunch!

[BUG] General error: 1364 Field 'name' doesn't have a default value

Prerequisites

  • [x ] Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • [ x] Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • [ x] Your issue isn't already filed.
  • [x ] You filled in the entire issue template.

Versions

  • PHP version: 7.3
  • Laravel version: 6.9
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

I am creating a contact form, where the user can add or remove contacts in their profile. When I save the data I get the following error:

SQLSTATE [HY000]: General error: 1364 Field 'name' doesn't have a default value (SQL: insert into users ( id, updated_at, created_at) values (?, 2019-12-28 10:08:03, 2019-12-28 10:08:03))

Steps to Reproduce

Illuminate\Database\QueryException

App\Forms\ContactosDeConfianza

    public $model = User::class;
    public $endpoint = "/laraform/process";

    public $buttons = [
        [
            'label' => 'Guardar',
            'class' => 'btn-primary',
            'type' => 'submit'
        ],
    
    ];

    public function schema()
    {
        return [
            'id' => [
                'type' => 'key',
                
            ],
            'contacts' => [
                'type' => 'list',
                'label' => false,
                'object' => [
                    'label' => 'Contacto',
                    'schema' => [
                        
                        'name' => [
                            'label' => false,
                            'type' => 'text',
                            'placeholder' => 'Nombre completo',
                            'floating' => 'Nombre completo',
                            'rules' => 'required',
                            
                            'name' => 'name',
                        ],
                        'curp' => [
                            'label' => false,
                            'type' => 'text',
                            'max' => 16,
                            'placeholder' => 'CURP',
                            'floating' => 'CURP',
                            'rules' => 'required',
                            
                        ],

                    ],
                ],
            ],

        ];
    }

Model User

    public function contacts()
    {
        return $this->hasMany(Contact::class);
    }

Model Contact

protected $fillable = ['name', 'curp', 'user_id'];
    protected $table = 'contacts';

    public function user()
    {
        return $this->belongsTo(User::class);
    }

Migration

Schema::create('contacts', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->unsigned();
            $table->string('name');
            $table->string('curp');

});

Final Error

SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value (SQL: insert into users (id, updated_at, created_at) values (?, 2019-12-28 10:08:03, 2019-12-28 10:08:03))

[BUG] Usage of Select within List

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.4
  • Laravel version: 6.7
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

When using a select element within a list as the element (at least in async mode), it produces a vue warning:
Invalid prop: type check failed for prop "name". Expected String with value "0", got Number with value 0.

Steps to Reproduce

I just changed the async select example from the docs and added a list wrapper:
schema: { mylist:{ type:'list', element:{ type: 'select', search: true, items: {}, slots: { noOptions: Vue.extend({ props: ['el$'], template: "<span>Start typing...</span>" }) }, options: { 'internal-search': false }, created() { this.on('searchChange', (searchQuery) => { this.loading = true if (this.timeout) { clearTimeout(this.timeout) } this.timeout = setTimeout(() => { if (!searchQuery) { this.loading = false return } this.items = { searchQuery: searchQuery, [searchQuery + '1']: searchQuery + '1', [searchQuery + '2']: searchQuery + '2', } this.loading = false }, 400) }) } } } }

Sorry for the codestyle, somehow github seems to remove my formatting.

Expected behavior:

Not getting a Vue Warn

Actual behavior:

Get a Vue Warn

Additional Information

It still seems to work okay, but you get an additional Vue Warn whenever opening the select box.
Trace:

`
[Vue warn]: Invalid prop: type check failed for prop "name". Expected String with value "0", got Number with value 0.

found in

---> at node_modules/vue-multiselect/src/Multiselect.vue
at node_modules/@laraform/laraform/src/themes/bs3/components/BaseElementLayout.vue
at node_modules/@laraform/laraform/src/themes/default/components/elements/SelectElement.vue
at node_modules/@laraform/laraform/src/themes/default/components/NestedElementLayout.vue
at node_modules/@laraform/laraform/src/themes/default/components/elements/ListElement.vue
at node_modules/@laraform/laraform/src/themes/bs3/components/FormElements.vue
at node_modules/@laraform/laraform/src/components/Laraform.vue
`

[BUG] Conditions need Path when Form created at Backend

Prerequisites

  • [ x] Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • [ x] Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration - all with full class).
  • [ x] Your issue isn't already filed.
  • [x ] You filled in the entire issue template.

Versions

  • PHP version: 7.4
  • Laravel version: 6.0
  • Laraform Vue package version and type: 1.1.10|pro
  • Laraform Laravel package version: 1.1.9|pro

Description

It seems that the path to the Component on which upon the condition is executed has to be supplied at the Schema. While maybe not a bug per see, it seems like undocumented behaviour.

Steps to Reproduce

SignupForm.php

'my_group' => [
    'type' => 'group',
    'label' => 'My Group',

    'schema' => [

        'my_group_enabled' => [
            'type' => 'checkbox',
            'label' => 'Show additional?'
        ],

        'my_group_additional' => [
            'type' => 'list',
            'label' => 'My Group Additional',
            'element' => [
                'type' => 'text'
            ],
            'conditions' => [
                ['my_group_enabled', true]
            ]
        ]

    ]
]

Expected behavior:

Should show "my_group_additional" when checkbox of "my_group_enabled" is checked.

Actual behavior:

Fails because it seems to look for "my_group_enabled" at the root level.

Additional Information

Supplying the path seems to fix the issue:

 'conditions' => [
                ['my_group.my_group_enabled', true]
            ]
        ]

[QUESTION] Adding fields to data after validation such as a slug

Prerequisites

  • You've read the documentation and couldn't find an answer.
  • Your question isn't already asked before.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.3.9
  • Laravel version: 6.6.2
  • Laraform Vue package version: 1.0.5
  • Laraform Laravel package version: 1.0.4

Description

I want to add additional generated fields to the form’s data such as creating a slug when the model is saved.

I tried the following in my form class but the slug field is never added to the SQL

public function boot() {
	$this->on('validated', function() {
		$this->data['slug'] = Str::slug($this->data['title']);
	});
}

Is it possible to do this, and if so how? I’d prefer to handle this server side not in Vue.

Unable to save data on model with non numeric key

I have a model whose primary key is a string, having created a record in it, later I can not save modifications to it, as laraform tries to insert instead of update.

Schema goes like this;

return [
'guid' => [
'type' => 'key',
'secret' => true
],
'otype' => [
'type' => 'hidden',
'default' => 'mandm',
'attribute' => 'type'
],
'name' => [
'type' => 'text',
'label' => 'Title',
'rules' => 'required'
],
'_props->pointer' => [
'type' => 'file',
'drop'=> true
]
];

The problem seems to be the code, at setKeyFromData() is trying to decode the key which was never encoded in the first place.

In the meantime I've modified ln 814 of Laraform.php from

$key = Hash::decode($key);

to

$key = Hash::decode($key)==[] ? $key : Hash::decode($key);

FYI, I am not sure I get the approach of the encode/decode key feature, I tend to think it aims to protect keys, I understand you avoid it when env. is local...

[BUG] Class constructor Rule cannot be invoked without 'new'"

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.2.24
  • Laravel version: 6.9
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

When creating a new unique Async rule, the rule cannot be invoked and throws a error in the console. I tried globally registering and just registering on the component, with out difference in result.

[Vue warn]: Error in mounted hook: "TypeError: Class constructor Rule cannot be invoked without 'new'"

Steps to Reproduce

Create new Async Rule
Register Rule Globally
Apply Rule on a Text Field
Compile & run the form, watch console.

Expected behavior:

I would expect the console not to throw an error and my async rule to be run on field input.

Actual behavior:

Console throws and error and the rule is never applied/run.

Additional Information

I tried to implement the document uppercase custom rule and the same console error occurs.

[BUG] Call to undefined method Illuminate\Support\Facades\DB::extend()

Prerequisites

  • [x ] Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • [ x] Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • [ x] Your issue isn't already filed.
  • [ x] You filled in the entire issue template.

Versions

  • PHP version: 7.3
  • Laravel version: 6.9
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1

Description

There is a problem related to multiple databases. If MongoDB is used with Laravel, it throws the following error: https://flareapp.io/share/47qGqBmW

If I remove the jenssegers / mongodb package, the problem is solved, but if I reinstall it, the problem returns.

Steps to Reproduce

Install jenssegers/mongodb package composer

Additional Information

The error appears to occur when the Mongodb provider is registered in the jenssegers / mongodb package

If in my class that extends Laraform I remove the variable or the schema method, the problem is deleted, but a Laraform error already throws me straight because I did not find that method

Screenshot from 2019-12-28 01-01-25

[QUESTION] Javascript File Size

Prerequisites

  • [X ] You've read the documentation and couldn't find an answer.
  • [X ] Your question isn't already asked before.
  • [X ] You filled in the entire issue template.

Versions

  • PHP version: 7.4
  • Laravel version: 6.6
  • Laraform Vue package version: 1.1.8 (Pro)
  • Laraform Laravel package version: 1.1.8 (Pro)

Description

First, I'd like to say, that this is a gread project.
I was completly impressed while reading about the features in the documentation!

Unfortunatly, at the moment i cannot really use it because of the filesize. At least not on a publically available website.

Is there a way to reduce the filesize or to split it in multiple files?

Even in minified production mode laraforms adds more than 1 MB to the Javascript file size.
That is just to much for any production website.

I've tried codesplitting, but if you directly import Laraforms only in the form files, you get an error (Failed to mount component: template or render function not defined.)
As soon as I follow the documentation and import it globally it works, but then the Filesize problem is back ;)

[QUESTION] Authorization / Autoprocessing

Prerequisites

  • You've read the documentation and couldn't find an answer.
  • Your question isn't already asked before.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.4
  • Laravel version: 6.6
  • Laraform Vue package version: 1.1.8 (Pro)
  • Laraform Laravel package version: 1.1.8 (Pro)

Description

Is there a way of authorizing form processing in the backend?
Otherwise any (even non registered) users could use and save all forms defined in the backend.

Of course you can manually process all forms and perform authorization logic there, but it would be much easier if there would be a built in way.
I saw there is an Authorization property in the Laraform Class and even a Authorization folder in the source, so i guess there mus be a way.
If there is, i guess its missing in the documentation

[QUESTION] Field label translation

Prerequisites

  • [X ] You've read the documentation and couldn't find an answer.
  • [X ] Your question isn't already asked before.
  • [X ] You filled in the entire issue template.

Versions

  • PHP version: 7.3.12
  • Laravel version: 6.7
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

Hi all

How do I manage labels translation? I use the package for a multilingual project (3 languages) and need to display fields label in user language.

Thanks for your help

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

[IDEA] Google Recaptcha

Prerequisites

  • You've described your idea in a clean format with example.

Versions

Description

Adding a field type for Google/Any Recaptcha would be awesome.
All sorts of forms use a captcha system to help prevent spam.

What you think?

Example

No sure how it would work/look like. But I would image you are familar with form captchas :)

Additional Information

"export 'extendTheme' was not found in '@laraform/laraform/src/utils'

I am trying to follow your documentation for extending the default theme

Error on compilation with Laravel Mix:

"export 'extendTheme' was not found in '@laraform/laraform/src/utils'

resources/js/laraform/theme/index.js

import { extendTheme } from '@laraform/laraform/src/utils'
import defaultTheme from '@laraform/laraform/src/themes/default'

export default extendTheme(defaultTheme, {
  classes: {},
  elements: {},
  components: {},
  layouts: {},
  grid: {},
})

[QUESTION] Limit items in a list

I have a question about how to limit the elements of a list, is it possible?

I am working with a list but I want it to have a limit of items, is that possible?

regards

[QUESTION] Button options

Prerequisites

  • You've read the documentation and couldn't find an answer.
  • Your question isn't already asked before.
  • You filled in the entire issue template.

Versions

  • PHP version: 7.4
  • Laravel version: 6.6
  • Laraform Vue package version: 1.1.8 (Pro)
  • Laraform Laravel package version: 1.1.8 (Pro)

Description

A few question about buttons:

  • Is it possible to create multiple button groups with different positions in the DOM? (for example 2 buttons on top of the form, one on the bottom)
    Actually the position in the DOM would not even have to change, it would just be nice to configure the buttons-container class per group and not only per form.

  • Is there a way to use icons (FontAwsome) within buttons, or to use HTML within the label?

  • Are conditions possible? (usefull, if the button availability depends on the users permissions)

Additional Information

None

[BUG] - Unknown custom element: <trix-editor>

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laraform.
  • Provided all the required dependencies to reproduce the bug (eg. form, component, model, migration).
  • [x ] Your issue isn't already filed.
  • You filled in the entire issue template.

Versions

  • PHP version: PHP 7.2.24
  • Laravel version: v6.9.0
  • Laraform Vue package version: 1.1.8
  • Laraform Laravel package version: 1.1.8

Description

[Vue warn]: Error in beforeMount hook: "ReferenceError: Vue is not defined"

ReferenceError: Vue is not defined

After installing and compiling Laraform into my environment, and use a "trix" form type, this error exists. However, the Trix input still operates.

Steps to Reproduce

Install Laravel with Laraform Pro Package
Install and compile laraform into app.js
Build a form and try load page

Expected behavior:
Generate form without any console error

Actual behavior:

Console Error occurs:

<Trix> at src/components/wrappers/Trix.vue
       <BaseElementLayout> at src/themes/bs3/components/BaseElementLayout.vue
         <TrixElement> at src/themes/default/components/elements/TrixElement.vue
           <FormElements> at src/themes/bs3/components/FormElements.vue
             <ProductCreateForm> at resources/backend/assets/js/components/Laraform/ProductCreateForm.vue
               <Root>

Additional Information

1.) If set Vue to use bootstrap vuejs instead, the Trix error does not occur.
2.) In Both cases: ReferenceError: Vue is not defined exists
3.) In the error output, BS3 is mentioned, but I am using bs4 as default theme

This is my Backend form:

class CustomForm extends Laraform
{

    /**
     * Form Schema
     * 
     * @return array
     */
    public function schema()
    {
        return [
            'email' => [
                'type' => 'trix',
                'label' => 'E-mail Address',
                'rules' => ['required','email']
            ],
        ];
    }
}

[QUESTION] Populating a select box from Eloquent relationship

PHP version: 7.3.9
Laravel version: 6.6.2
Laraform Vue package version: 1.0.5
Laraform Laravel package version: 1.0.4

Description

I’ve a one to many relationship between two models - Entries and Schools. Schools can have many Entries and Entries can have one School.

How can I create a select box on an Entry that lists all the Schools as options (and can I show a subset if required)?

I can’t see this in the docs and the examples are client side for VueJS.

Thanks

Event to modify field after submit and before save (backend)...

Hi, testing laraform, I want to know if it is possible to modify a value after being submitted but before saved, so for instance I have first and last name, I'd like the concatenated value of these two to be the value for fullname existing property.

I tried getting and setting the data in the saving() event, data obtained after modification seems to work but concatenated data is not persisted.

´public function saving() {

$_data = $this->getElements()->getData();
$_data['name'] = $_data['firstname'].' '.$_data['lastname'];
$this->getElements()->setData($_data);
// dd($this->getElements()->getData());  <<< shows field name modified correctly

Issues with file attached to entry

This is what I have;

  1. schema;

return [
'guid' => [
'type' => 'key',
'secret' => true
],
'otype' => [
'type' => 'hidden',
'default' => 'mandm',
'attribute' => 'type'
],
'name' => [
'type' => 'text',
'label' => 'Title',
'rules' => 'required'
],
'_props->pointer' => [
'type' => 'file',
'drop'=> true
]
];

Creating a new entry works ok, file gets uploaded and saved where it is expected, the problem is that the file uploaded ended up in its destiny folder not with its original file name but with a char(40) hash so in my case stick.png got saved as FgSK94lhmPcP9GLqtxmvI4Z3r3IJYr39eFCeYYuR.png

Thoughts ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.