{{-- contoh select biasa: contoh multiple select: --}} @props([ 'name', 'options', 'id' => null, 'selected' => null, 'placeholder' => null, 'clearable' => false, 'multiple' => false, 'class' => '', 'required' => false, 'disabled' => false, ]) @php $id = $id ?? 'select2_' . $name . '_' . uniqid(); // function untuk cek apakah array berbentuk // $data = [ // 'Group 1' => [ // 1 => 'Option 1', // 2 => 'Option 2', // ], // 'Group 2' => [ // 3 => 'Option 3', // 4 => 'Option 4', // ], // ]; $hasGroups = function ($array) { foreach ($array as $value) { if (is_array($value)) { return true; } } return false; }; @endphp
@pushOnce('style') @endPushOnce {{-- ini akan dipush 1x karena content didalamnya tidak berubah --}} @pushOnce('script') @endPushOnce {{-- kode ini akan di render berkali2 --}} @push('script') @endpush