### Configuring Tabs Source: https://laraform.io/docs/1.x/basics/wizard-and-tabs This example demonstrates how to configure tabs with custom button labels and disabling the 'previous' button for the first tab. ```php [ 'label' => 'Personal details', 'elements' => ['firstname', 'lastname'], 'buttons' => [ 'previous' => false ] ], 'contact_details' => [ 'label' => 'Contact details', 'elements' => ['email', 'phone'], 'labels' => [ 'previous' => 'Go back', 'next' => 'Continue' ] ], 'job_history' => [ 'label' => 'Job history', 'elements' => ['previous_jobs'] ] ]; } public function schema() { return [ 'firstname' => [ 'type' => 'text', 'label' => 'First name' ], 'lastname' => [ 'type' => 'text', 'label' => 'Last name' ], 'email' => [ 'type' => 'text', 'label' => 'Email' ], 'phone' => [ 'type' => 'text', 'label' => 'Phone' ] ]; } } ``` -------------------------------- ### Create Theme File Source: https://laraform.io/docs/1.x/how-tos/creating-theme Create a new theme file to define custom styles and properties. This example extends the default 'bs4' theme. ```javascript import utils from '@laraform/laraform/src/utils' import bs4 from '@laraform/laraform/src/themes/bs4' export default utils.extendTheme(bs4, { classes: {}, elements: {}, components: {}, layouts: {}, grid: {}, }) ``` -------------------------------- ### Create Theme Styles Source: https://laraform.io/docs/1.x/how-tos/creating-theme Create a SCSS file to extend existing theme styles. This example imports default 'bs4' variables, mixins, and components. ```scss .my-theme { @import '~laraform/src/themes/bs4/scss/vars'; @import '~laraform/src/themes/bs4/scss/mixins'; @import '~laraform/src/themes/bs4/scss/components'; } ``` -------------------------------- ### Install Webpack Bundle Analyzer Source: https://laraform.io/docs/1.x/how-tos/optimization Install the webpack-bundle-analyzer package to analyze your bundle size. This is a development dependency. ```bash $ npm install --save-dev webpack-bundle-analyzer ``` -------------------------------- ### Filesystem Disk Configuration Example Source: https://laraform.io/docs/1.x/how-tos/uploading-files Illustrates the configuration for different storage disks within Laravel's filesystem settings. The 'public' disk is commonly used for web-accessible files. ```php // config/filesystems.php return [ // ... 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_KEY'), 'secret' => env('AWS_SECRET'), 'region' => env('AWS_REGION'), 'bucket' => env('AWS_BUCKET'), ], ], // ... ] ``` -------------------------------- ### Install Laraform Vue Package Source: https://laraform.io/docs/1.x/installation Install the Laraform Vue package using npm after setting up the private registry and dependencies. ```bash $ npm install @laraform/laraform --save ``` -------------------------------- ### Create a Simple Wizard Form Source: https://laraform.io/docs/1.x/basics/wizard-and-tabs Define a multi-step form by specifying steps, their labels, and the elements within each step. This example creates a profile form with personal details, contact details, and job history steps. ```php [ 'label' => 'Personal details', 'elements' => ['firstname', 'lastname'], 'buttons' => [ 'previous' => false ] ], 'contact_details' => [ 'label' => 'Contact details', 'elements' => ['email', 'phone'], 'labels' => [ 'previous' => 'Go back', 'next' => 'Continue' ] ], 'job_history' => [ 'label' => 'Job history', 'elements' => ['previous_jobs'] ] ]; } public function schema() { return [ 'firstname' => [ 'type' => 'text', 'label' => 'First name' ], 'lastname' => [ 'type' => 'text', 'label' => 'Last name' ], 'email' => [ 'type' => 'text', 'label' => 'Email' ], 'phone' => [ 'type' => 'text', 'label' => 'Phone' ] ]; } } ``` -------------------------------- ### Import Laraform and Install Vue Plugin Source: https://laraform.io/docs/1.x/how-tos/using-only-frontend Import Laraform and use Vue.use() to install it globally. This makes Laraform available throughout your Vue application. ```javascript import Vue from 'vue' import Laraform from '@laraform/laraform' Vue.use(Laraform) const app = new Vue({ el: '#app' }) ``` -------------------------------- ### Basic CheckboxGroup Example Source: https://laraform.io/docs/1.x/reference/checkboxgroup-element This snippet demonstrates the basic structure of a CheckboxGroup element. It includes a label and a list of options, each with a value and label. ```html ``` -------------------------------- ### Register Theme File Source: https://laraform.io/docs/1.x/how-tos/creating-theme Register your custom theme with Laraform using the `.theme()` method before installing Laraform. This example uses 'my-theme'. ```javascript import Vue from 'vue' import Laraform from '@laraform/laraform/src' import MyTheme from './themes/my_theme' Laraform.theme('my-theme', MyTheme) Vue.use(Laraform) const app = new Vue({ el: '#app' }) ``` -------------------------------- ### Install Laravel Package Source: https://laraform.io/docs/1.x/installation Install the Laraform Laravel package using Composer. You will be prompted for your username and password, which are your Laraform account's email and password. ```bash composer require laraform/laraform-laravel ``` -------------------------------- ### Define Route for Auto-Update Example Source: https://laraform.io/docs/1.x/basics/updating-data This route renders the user profile form without loading any initial data, allowing for the auto-update mechanism to be demonstrated. ```php Route::get('/user/profile', function(){ return view('user.profile', [ 'form' => app('App\Forms\UserForm') ]) }) ``` -------------------------------- ### Conditional Wizard Step Source: https://laraform.io/docs/1.x/basics/wizard-and-tabs This example shows how to make the 'Company details' wizard step conditional, appearing only when the 'Register as company' checkbox is checked. ```php [ 'label' => 'Personal details', 'elements' => ['name', 'register_company'] ], 'company_details' => [ 'label' => 'Company details', 'elements' => ['company_name', 'company_address'], // Company details conditions 'conditions' => [ ['register_company', true] ] ], 'account_details' => [ 'label' => 'Account details', 'elements' => ['email', 'password'], ] ]; } public function schema() { return [ 'name' => [ 'type' => 'text', 'label' => 'Name', 'rules' => 'required' ], 'register_company' => [ 'type' => 'checkbox', 'text' => 'Register as company' ], 'company_name' => [ 'type' => 'text', 'label' => 'Company name', ], 'company_address' => [ 'type' => 'text', 'label' => 'Company address', ], 'email' => [ 'type' => 'text', 'label' => 'Email address' ], 'password' => [ 'type' => 'text', 'label' => 'Password' ] ]; } } ``` -------------------------------- ### Example Data for Nested Objects Source: https://laraform.io/docs/1.x/basics/nested-elements This is an example of how data would be structured when using nested objects within a list. ```json data: { name: 'Purple Cobras', members: [ { name: 'Josh', shirt_number: 7, birthday: '21/03/1988' }, { name: 'John', shirt_number: 21, birthday: '18/05/1973' }, { name: 'James', shirt_number: 9, birthday: '19/11/1983' }, ] } ``` -------------------------------- ### Alternative File Storage Folder Source: https://laraform.io/docs/1.x/how-tos/uploading-files Example of setting a different folder name for storing uploaded files. This configuration overrides the default 'files' folder. ```php /* |-------------------------------------------------------------------------- | Store |-------------------------------------------------------------------------- | | Default location to store uploaded files. | */ 'store' => [ 'disk' => 'public', 'folder' => 'uploads' ] ``` -------------------------------- ### Install Vue Recaptcha Package Source: https://laraform.io/docs/1.x/how-tos/creating-element Install the `vue-recaptcha` package using npm to integrate Google reCAPTCHA into your custom element. ```bash $ npm install --save vue-recaptcha ``` -------------------------------- ### Simplified TextElement Template Example Source: https://laraform.io/docs/1.x/basics/style-and-theme Illustrates how a schema-defined class is applied to the outermost container in a simplified element template. ```html ``` -------------------------------- ### Install npm Dependencies Source: https://laraform.io/docs/1.x/installation Install required peer dependencies for the Laraform Vue package before installing Laraform itself. ```bash $ npm install axios lodash moment vue@2 --save-dev ``` -------------------------------- ### Basic Gallery Usage Source: https://laraform.io/docs/1.x/reference/gallery-element Renders a multi-image uploader with default settings. This is the most basic implementation. ```html ``` -------------------------------- ### Using Addon Source: https://laraform.io/docs/1.x/reference/password-element Renders a password input with an addon element before the input field. ```APIDOC ### Examples **Using Addon** Renders a password input with `before` addon. ```javascript ``` ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/slider-element Renders a simple slider with default settings. ```APIDOC ## Slider Element An element used to render slider with vue-slider-component ### Basic Usage Renders a slider. ```javascript ``` ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/image-element Renders a standard image uploader. ```APIDOC ## Basic Usage Renders an image uploader. ```javascript ``` ``` -------------------------------- ### Bootstrap 4 Theme Override Example Source: https://laraform.io/docs/1.x/basics/style-and-theme This example shows how to override a default Laraform SCSS variable, such as `$lf-primary-color`, with a Bootstrap 4 variable (`$primary`). This is typically done in a theme's SCSS file. ```scss // ./path/to/bs4/scss/theme.scss //== Genaral // //## Font sizes, colors, backgrounds and more. $lf-primary-color: $primary !default; ``` -------------------------------- ### Vue Component Structure Source: https://laraform.io/docs/1.x/how-tos/dynamic-form-loading Example of a Vue component that includes a form component. ```html ``` -------------------------------- ### Options Source: https://laraform.io/docs/1.x/reference/textarea-element Lists the available options for configuring the textarea element, including autogrow, rows, default values, placeholders, and more. ```APIDOC ## Options Name | Type | Description ---|---|--- **autogrow** | `boolean` | Whether the textarea should grow automatically as user inserts new lines. **rows** | `number` | Initial number of rows of the textarea. **default** | `string` | Value of element when the form is initially loaded or reseted. **placeholder** | `string` | The placeholder of the element. **floating** | `string` | The floating label of the element. **disabled** | `boolean` | Whether the field is _disabled_. **readonly** | `boolean` | Whether the field is _readonly_. ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/radio-element Demonstrates how to render a basic radio button and variations with default values and disabled states. ```APIDOC ## Radio Element - Basic Usage Render a radio button. ```javascript ``` ``` -------------------------------- ### Conditional Tab Source: https://laraform.io/docs/1.x/basics/wizard-and-tabs This example shows how to make the 'Product gallery' tab conditional, appearing only if the 'Has gallery' checkbox is checked. ```php [ 'label' => 'Product details', 'elements' => ['name', 'description', 'has_gallery'] ], 'product_gallery' => [ 'label' => 'Product gallery', 'elements' => ['gallery'], // Product gallery conditions 'conditions' => [ ['has_gallery', true] ] ] ]; } public function schema() { return [ 'name' => [ 'type' => 'text', 'label' => 'Product name' ], 'description' => [ 'type' => 'text', 'label' => 'Product description' ], 'has_gallery' => [ 'type' => 'checkbox', 'text' => 'Has gallery' ], 'gallery' => [ 'type' => 'gallery', 'label' => 'Gallery' ] ]; } } ``` -------------------------------- ### Minify Assets with npm run prod Source: https://laraform.io/docs/1.x/how-tos/optimization Run the 'npm run prod' command to minify your project's assets, a standard practice for optimizing production builds. ```bash $ npm run prod ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/file-element Renders a standard file uploader component. ```APIDOC ## Basic Usage Renders a file uploader. ```javascript ``` ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/trix-element Renders a standard Trix editor. This is the most straightforward way to implement the Trix Element. ```APIDOC ## Basic Usage Renders a Trix editor. ```javascript ``` ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/toggle-element Renders a toggle with text next to it. ```APIDOC ## Basic Usage Renders a toggle with text next to it. ```vue ``` ``` -------------------------------- ### Basic Radio Button Usage Source: https://laraform.io/docs/1.x/reference/radio-element Renders a simple radio button with a text label. Includes examples for default values and disabled states. ```javascript ``` -------------------------------- ### Configure npm Private Registry Source: https://laraform.io/docs/1.x/installation Add these lines to your project's .npmrc file to authenticate with the private npm registry. Replace YOUR_AUTH_TOKEN with your generated token. ```bash @laraform:registry=https://npm.laraform.io //npm.laraform.io/:_authToken="YOUR_AUTH_TOKEN" ``` -------------------------------- ### Create Custom FormButton Component Source: https://laraform.io/docs/1.x/how-tos/replacing-component Extend the default FormButton component to create a custom version. This example assumes you are using the 'bs4' theme. ```vue ``` -------------------------------- ### Database Migration for Subscribers Source: https://laraform.io/docs/1.x/basics/submitting-data Create a database migration to add 'email' and 'ip' columns to the 'subscribers' table. ```php public function up() { Schema::create('subscribers', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('email'); $table->string('ip'); $table->timestamps(); }); } ``` -------------------------------- ### FormWizardStep Methods Source: https://laraform.io/docs/1.x/reference/frontend-wizard-step This section details the available methods for interacting with the FormWizardStep component. ```APIDOC ## Methods #### # .on(event, callback) ###### Parameters * `event` string : event to listen for. * `callback` function : callback to run when the event is triggered. The `this` variable refers to the component the listener is set for. Adds a listener for an event. * * * #### # .off(event) ###### Parameters * `event` string : event to remove the listeners for. Removes all listeners for an event. * * * #### # .fire(event, args) @returns {any} ###### Parameters * `event` string : event to fire. * `args` object : arguments to pass for the event's listeners. Fires an event. * * * #### # .__(expr, data) @returns {string} ###### Parameters * `expr` string : expression to be translated using `.` dot syntax. * `data` object : data to be passed for the expression Translates an expression to current locale. * * * #### # .validate() Validate the elements within the step. * * * #### # .proceed(callback) ###### Parameters * `callback` function : callback to call when the form is ready to proceed Prepares to proceed to the next step. If validateOn contains 'step' it first validates any unvalidated element and wait for async validators to finish. Only continues no elements has `invalid` status. * * * #### # .activate() Activates the step. * * * #### # .deactivate() Deactivates the step. * * * #### # .enable() Enables the step. * * * #### # .disable() Disables the step. * * * #### # .complete() Completes the step. * * * #### # .uncomplete() Uncompletes the step. * * * #### # .select() Selects the step to become the active step. * * * ``` -------------------------------- ### Add Global Theme Source: https://laraform.io/docs/1.x/basics/configuration Register a custom theme globally by specifying a name and the theme object. ```javascript import Laraform from '@laraform/laraform' import CustomTheme from './path/to/CustomTheme.vue' Laraform.theme('custom', CustomTheme) ``` -------------------------------- ### Adding a New Locale Source: https://laraform.io/docs/1.x/basics/internationalization Add a new locale to Laraform by calling the `.locale()` method with the locale name and its translation object before installing the Laraform plugin. ```javascript import Vue from 'vue' import Laraform from '@laraform/laraform' import fr_FR from './path/to/fr_FR' Laraform.locale('fr_FR', fr_FR) Vue.use(Laraform) const app = Vue({ el: '#app' }) ``` -------------------------------- ### Basic Checkbox Usage Source: https://laraform.io/docs/1.x/reference/checkbox-element Renders a simple checkbox option. Includes examples for a default unchecked, default checked, disabled, and disabled checked checkbox. ```javascript ``` -------------------------------- ### getWizard() Source: https://laraform.io/docs/1.x/reference/backend-laraform Returns the form wizard configuration. ```APIDOC ## getWizard() ### Description Returns the form wizard configuration. ### Returns - `array`: The form wizard configuration. ``` -------------------------------- ### Create and Configure Vuex Store Source: https://laraform.io/docs/1.x/how-tos/using-vuex Instantiate a Vuex store and register it with Laraform and Vue. This sets up the global state management for your forms. ```javascript import Vue from 'vue' import Vuex from 'vuex' import Laraform from '@laraform/laraform' Vue.use(Vuex) const store = new Vuex.Store({ state: { forms: { changePassword: {} } }, // ... }) Laraform.store(store) Vue.use(Laraform) const app = new Vue({ el: '#app', store }) ``` -------------------------------- ### Customize Textarea Element setData Method Source: https://laraform.io/docs/1.x/how-tos/creating-element Extend the base TextareaElement to override the `setData` method, for example, to strip HTML tags from the input data. ```php data = strip_tags($data); } } ``` -------------------------------- ### Regex Validation Example Source: https://laraform.io/docs/1.x/basics/validation Use the regex rule to validate input against a specific pattern. When using pipe characters in the pattern, define rules as an array. ```php 'rules' => 'not_regex:/^.+$/i' ``` ```php 'rules' => 'regex:/^.+$/i' ``` -------------------------------- ### With Labels Source: https://laraform.io/docs/1.x/reference/toggle-element Renders labels for the toggle using the `labels` option. ```APIDOC ## With labels Renders labels for the toggle using `labels` option. ```vue ``` ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/avatar-element Demonstrates the default behavior of the Avatar element, showing a placeholder image that is replaced upon upload and allows for larger previews. ```APIDOC ## Avatar Element An element used for profile images. ### Basic Usage By default a placeholder image is shown which is replaced by the actual image, once uploaded. Clicking the uploaded image triggers it's larger preview. ```javascript ``` ``` -------------------------------- ### Tags Input with Create Option Source: https://laraform.io/docs/1.x/reference/tags-element Enables users to create new tags on the fly by setting the `create` option to `true`. Useful when predefined tags are not exhaustive. ```javascript ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/time-element Renders a standard time input field. ```APIDOC ## Basic Usage Renders a time input. ### Code Example ```javascript ``` ``` -------------------------------- ### Nested List Example Source: https://laraform.io/docs/1.x/reference/list-element Nests two object lists to create a hierarchical data structure. The outer list contains 'venue' and an inner 'events' list. ```javascript export default { mixins: [Laraform], data: () => ({ schema: { list: { type: 'list', label: 'Schedule', object: { schema: { venue: { type: 'text', label: 'Venue', placeholder: 'Venue name', floating: 'Venue name' }, events: { type: 'list', label: 'Events', object: { schema: { name: { type: 'text', placeholder: 'Event name', floating: 'Event name' }, starts: { type: 'text', placeholder: 'Starts at', floating: 'Starts at' } } } } } }, default: [ { venue: 'Riverside', events: [ { name: 'Ceremony opener', starts: '19:00' }, { name: 'Announcement', starts: '20:00' }, ] } ] } } }) } ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/password-element Renders a standard password input field. ```APIDOC ## Password Element An element used to render a password input. ### Examples **Basic Usage** Renders a password input. ```javascript ``` ``` -------------------------------- ### Nested Object Elements Source: https://laraform.io/docs/1.x/reference/object-element Nest multiple 'object' elements to create complex, hierarchical data structures. This example shows nested 'personal' and 'contact' information. ```javascript export default { mixins: [Laraform], data: () => ({ schema: { personal: { type: 'object', label: 'Personal Information', schema: { name: { type: 'object', schema: { firstname: { type: 'text', placeholder: 'First name', floating: 'First name', columns: 6 }, lastname: { type: 'text', placeholder: 'Last name', floating: 'Last name', columns: 6 } } }, profession: { type: 'text', placeholder: 'Profession', floating: 'Profession' } } }, contact: { type: 'object', label: 'Contact Information', schema: { contacts: { type: 'object', schema: { email: { type: 'text', placeholder: 'Email', floating: 'Email', columns: 6 }, phone: { type: 'text', placeholder: 'Phone', floating: 'Phone', columns: 6 } } }, address: { type: 'text', placeholder: 'Address', floating: 'Address' } } } } }) } ``` -------------------------------- ### Basic Object Element Usage Source: https://laraform.io/docs/1.x/reference/object-element Use the 'object' type to create a wrapper element for related fields. This example demonstrates grouping 'firstname' and 'lastname' fields. ```javascript export default { mixins: [Laraform], data: () => ({ schema: { name: { type: 'object', label: 'Name', schema: { firstname: { type: 'text', placeholder: 'First name', floating: 'First name', columns: 6 }, lastname: { type: 'text', placeholder: 'Last name', floating: 'Last name', columns: 6 }, } } } }) } ``` -------------------------------- ### Create Vue Component for Custom Element Source: https://laraform.io/docs/1.x/how-tos/creating-element Define the frontend component for your custom element, including its template and script logic. This example shows a Recaptcha element. ```vue ``` -------------------------------- ### Multilingual Validation Rules Source: https://laraform.io/docs/1.x/basics/validation Define different validation rules for each language when working with multilingual form elements. This example shows a 'required' rule for English titles. ```php [ 'code' => 'en', 'label' => 'English' ], 'de' => [ 'code' => 'de', 'label' => 'German' ] ]; public function schema() { return [ 'title' => [ 'type' => 't-text', 'label' => 'Title', 'rules' => [ 'en' => 'required', ] ], ]; } } ``` -------------------------------- ### Basic Multifile Uploader Source: https://laraform.io/docs/1.x/reference/multifile-element Renders a standard multifile uploader. This is the default configuration. ```javascript ``` -------------------------------- ### Define Basic Form Schema Source: https://laraform.io/docs/1.x/basics/customizing-layout This script defines a basic form schema with 'name', 'email', and 'phone' fields. It's the starting point before customizing the layout. ```javascript ``` -------------------------------- ### Compile Assets Source: https://laraform.io/docs/1.x/basics/rendering Compile your frontend assets using npm to make your form visible on the site. ```bash npm run dev ``` -------------------------------- ### Add onClick Handler to Button in Vue Source: https://laraform.io/docs/1.x/how-tos/extending-on-frontend Extend a button defined in the backend with custom frontend behavior using the 'onClick' option. This example adds a reset functionality. ```javascript ``` -------------------------------- ### Basic Usage Source: https://laraform.io/docs/1.x/reference/radiogroup-element Renders a group of radio buttons with predefined items and a default selection. ```APIDOC ## Radio Group Element - Basic Usage ### Description Renders a group of radio buttons. ### Method N/A (Component Usage) ### Endpoint N/A (Component Usage) ### Request Example ```javascript ``` ### Response N/A (Component Usage) ``` -------------------------------- ### Options Source: https://laraform.io/docs/1.x/reference/radiogroup-element Lists the available options for configuring the Radio Group Element. ```APIDOC ## Radio Group Element - Options ### Description Lists the available options for configuring the Radio Group Element. ### Options | Name | Type | Description | |---|---|---| | **items** | `object` | List of checkbox options. | | **disable** | `array` | List of option keys to be disabled. | | **disabled** | `boolean` | Whether the field is _disabled_. | | **default** | `str|num` | Value of element when the form is initially loaded or reseted. | ``` -------------------------------- ### Create Frontend Form Component Source: https://laraform.io/docs/1.x/how-tos/dynamic-form-loading A basic example of a custom form component that utilizes the Laraform mixin. Ensure your form component extends Laraform to inherit its functionality. ```vue ``` -------------------------------- ### Override TextareaElement Template Source: https://laraform.io/docs/1.x/how-tos/creating-element Extend the default TextareaElement template to customize its HTML structure. This example shows how to override the template to include custom slots and modify the textarea element itself. ```html