diff --git a/resources/views/form/checkbox.blade.php b/resources/views/form/checkbox.blade.php
index 406c8b1559..767cfe5a42 100644
--- a/resources/views/form/checkbox.blade.php
+++ b/resources/views/form/checkbox.blade.php
@@ -15,6 +15,28 @@
@include('admin::form.error')
+ @if($groups)
+
+ @foreach($groups as $group => $options)
+
+
{{ $group }}
+
+ @foreach($options as $option => $label)
+
+
+
+
+
+
+
+ @endforeach
+
+ @endforeach
+
+ @else
+
@foreach($options as $option => $label)
{!! $inline ? '' : '' !!}
@@ -27,6 +49,8 @@
@endforeach
+ @endif
+
@include('admin::form.help-block')
diff --git a/src/Form/Field/Checkbox.php b/src/Form/Field/Checkbox.php
index 52b8a8a323..f6358761da 100644
--- a/src/Form/Field/Checkbox.php
+++ b/src/Form/Field/Checkbox.php
@@ -10,6 +10,8 @@ class Checkbox extends MultipleSelect
protected $canCheckAll = false;
+ protected $groups = null;
+
protected static $css = [
'/vendor/laravel-admin/AdminLTE/plugins/iCheck/all.css',
];
@@ -57,6 +59,20 @@ public function canCheckAll()
return $this;
}
+ /**
+ * Set chekbox groups.
+ *
+ * @param array
+ *
+ * @return $this
+ */
+ public function groups($groups = [])
+ {
+ $this->groups = $groups;
+
+ return $this;
+ }
+
/**
* Set checked.
*
@@ -110,6 +126,7 @@ public function render()
'checked' => $this->checked,
'inline' => $this->inline,
'canCheckAll' => $this->canCheckAll,
+ 'groups' => $this->groups,
]);
if ($this->canCheckAll) {