We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73aca6a commit e600ea0Copy full SHA for e600ea0
src/Kris/LaravelFormBuilder/Fields/FormField.php
@@ -736,6 +736,18 @@ public function enable()
736
return $this;
737
}
738
739
+ /**
740
+ * Whether this field is disabled.
741
+ *
742
+ * @return bool
743
+ */
744
+ public function isDisabled()
745
+ {
746
+ $disabled = $this->getOption('attr.disabled');
747
+
748
+ return $disabled !== null && $disabled !== false;
749
+ }
750
751
/**
752
* Get validation rules for a field if any with label for attributes.
753
*
@@ -775,7 +787,7 @@ public function getValidationRules()
775
787
*/
776
788
public function getAllAttributes()
777
789
{
778
- return [$this->getNameKey()];
790
+ return $this->isDisabled() ? [] : [$this->getNameKey()];
779
791
780
792
781
793
0 commit comments