1. Go to this page and download the library: Download codicastudio/conditional library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
codicastudio / conditional example snippets
use DigitalCreative\ConditionalContainer\ConditionalContainer;
use DigitalCreative\ConditionalContainer\HasConditionalContainer;
class ExampleNovaResource extends Resource {
use HasConditionalContainer; // Important!!
public function fields(Request $request)
{
return [
Select::make('Option', 'option')
->options([
1 => 'Option 1',
2 => 'Option 2',
3 => 'Option 3',
]),
Text::make('Content', 'content')->rules(' 2 && $content > 10) || $option === 3)
*/
ConditionalContainer::make([ Text::make('Field C')->rules(' ])
->if('option = 3 OR content = demo')
];
}
}
ConditionalContainer::make(...)->if('first_name = John');
ConditionalContainer::make(...)->if('(first_name = John AND last_name = Doe) OR (first_name = foo AND NOT last_name = bar)');
ConditionalContainer::make(...)->if('first_name = John AND last_name = Doe');