Download the PHP package digital-creative/conditional-container without Composer
On this page you can find all versions of the php package digital-creative/conditional-container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download digital-creative/conditional-container
More information about digital-creative/conditional-container
Files in digital-creative/conditional-container
Package conditional-container
Short Description Provides an easy way to conditionally show and hide fields in your Nova resources.
License MIT
Informations about the package conditional-container
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
Reasonfield is empty, show extra fields otherwise.
License
The MIT License (MIT). Please see License File for more information.