-
-
Notifications
You must be signed in to change notification settings - Fork 86
Conditional Field
TinaH edited this page Dec 8, 2020
·
2 revisions
public function fields()
{
return [
$this->someBoolean ? Input::make('Conditional Field 1')->required() : Input::make('Conditional Field 2')->required(),
];
}
public function conditional()
{
if($this->something === "No") {
return false; //the field will be omitted
} else {
return true; //the field will be included
}
}
//this field will be omitted if the method returns false
public function fields()
{
return [
$this->conditional() ? Input::make('Conditional Field')->required() : null,
];
}
public function fields()
{
return [
$this->someMethod(),
];
}
public function someMethod()
{
$boolean = //something that returns true or false;
if($boolean)) {
return Input::make('Conditional Field')->required();
} else {
return null;
}
}
- Installation
- Requirements
- v5 Upgrade Guide
- v6 Upgrade Guide
- v7 Upgrade Guide
- Support
- Quickstart
- Manual installation
- Optional
- Form component
- Field
- Field types
- Example Form
- Blade Components
- Notifications