Download the PHP package codicastudio/conditional without Composer
On this page you can find all versions of the php package codicastudio/conditional. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codicastudio/conditional
More information about codicastudio/conditional
Files in codicastudio/conditional
Package conditional
Short Description A random Codica Studio package.
License MIT
Homepage https://github.com/codicastudio/conditional
Informations about the package conditional
Conditional Container
Provides an easy way to conditionally show and hide fields in your Nova resources.
Installation
You can install the package via composer:
Usage
Basic demo showing the power of this field:
The ->if()
method takes a single expression argument that follows this format:
you can build any complex logical operation by wrapping your condition in ()
examples:
you can chain multiple ->if()
together to group your expressions by concern, example:
by default the operation applied on each ->if()
will be OR
, therefore if any of the if methods evaluates to true the whole
operation will be considered truthy, if you want to execute an AND
operation instead append ->useAndOperator()
to the chain
Currently supported operators:
- AND
- OR
- NOT
- XOR
- and parentheses
Currently supported comparators:
Comparator | Description |
---|---|
> | Greater than |
< | Less than |
<= | Less than or equal to |
>= | Greater than or equal to |
== | Equal |
=== | Identical |
!= | Not equal |
!== | Not Identical |
truthy / boolean | Validate against truthy values |
contains / includes | Check if input contains certain value |
startsWith | Check if input starts with certain value |
endsWith | Check if input ends with certain value |
Examples
-
Display field only if user has selected file
-
Display extra fields only if selected morph relation is of type Image or Video
- Display inline HTML only if
Reason
field is empty, show extra fields otherwise.
License
The MIT License (MIT). Please see License File for more information.