Download the PHP package mikkimike/orchid-repeater-field without Composer
On this page you can find all versions of the php package mikkimike/orchid-repeater-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mikkimike/orchid-repeater-field
More information about mikkimike/orchid-repeater-field
Files in mikkimike/orchid-repeater-field
Package orchid-repeater-field
Short Description Adding support of repeater field to the Orchid RAD platform.
License wtfpl
Homepage https://github.com/nakukryskin/orchid-repeater-field
Informations about the package orchid-repeater-field
Orchid Platform Repeater Field
Brief
We've all worked with WordPress at one time or another. Inspired by Advanced Custom Fields.
This package adding repeater fields support to Orchid RAD platform.
Pre-requirements
You must have installed and configured Orchid Platform
Version Support: .*
For ^13.0.1 use ^13.0.0 tag and newer.
Older versions do not have support for most of the current functionality.
For 6.* version use 2.0.5 tag.
For 5 version use 1.0.0 tag.
For 4.7.1 version use 0.0.8 tag.
How to use
-
Install package with composer:
composer require nakukryskin/orchid-repeater-field
Latest version of laravel automatically discover package to use.
-
Create
RepeaterFields.php
in your Orchid Layouts directory. Example: -
Simply start adding the
RepeaterField::make('repeater')
in your screen: Example: - Open your screen and check that the repeater fields here
Advanced usage
Repeater field also support required, max and min parameters. You can add these parameters with call the RepeaterField.
If ->required()
passed to the constructor automatically will set min
to 1. If the user tries to delete this field,
it will be prevented and show the message.
You can also change the text when deleting a block using the
method ->confirmText('Are you sure that you want to delete the block?')
.
To show required message on save you must add this rule to your screen rules, eg. 'content.*.repeater' => 'required'
You also can rename button label with your own with method buttonLabel()
.
eg.
In extreme cases, if you are using some kind of dynamic data loading and you need to pass additional data to your
Layout, use the ->ajaxData()
method. This method can work both with a callable function and with an array of data.
This can be useful when you need to filter the data for each of the fields.
To use ajaxData, first connect trait AjaxDataAccess
to your Layout:
After that, on the main screen, determine what you want to transmit. In the example, we generate a list based on the current user role:
You can combine output options and what and when to output to the user in your repeater fields. Note that your Layout knows nothing about the state of the other fields on the current screen and, if you want to transfer data about the current fields you must first save the record and use the data and query of your main screen.