Skip to content

Commit

Permalink
Removed die() if data keys are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
mkocansey committed Sep 16, 2024
1 parent 8dadcd2 commit 01db7c0
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions resources/views/components/select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,14 @@
$filter = preg_replace('/[\s-]/', '_', $filter);
$selected_value = ($selected_value != '') ? explode(',', str_replace(', ', ',', $selected_value)) : [];
if ($data !== 'manual' && count($data)) {
if ($data !== 'manual') {
$data = (!is_array($data)) ? json_decode(str_replace('"', '"', $data), true) : $data;
if(! isset($data[0][$label_key]) ) {
die('<p style="color:red">
&lt;x-bladewind.select /&gt;: ensure the value you set as label_key
exists in your array data</p>');
}
if( !empty($flag_key) && !isset($data[0][$flag_key]) ) {
die('<p style="color:red">
&lt;x-bladewind.select /&gt;: ensure the value you set as flag_key exists in your array</p>');
}
}
$size = (!in_array($size, ['small','medium', 'regular', 'big'])) ? 'medium' : $size;
$sizes = [ 'small' => 'py-[6px]', 'medium' => 'py-[10px]', 'regular' => 'py-[6.5px]', 'big' => 'py-[18.5px]' ];
@endphp
<style>
<style xmlns:x-bladewind="http://www.w3.org/1999/html">
.display-area::-webkit-scrollbar {
display: none;
width: 0 !important;
Expand Down Expand Up @@ -218,7 +207,7 @@ class="!border-0 !border-b !rounded-none focus:!border-slate-300 dark:focus:!bor
onselect="{{ $onselect }}"
flag="{{ $item[$flag_key] ?? '' }}"
image="{{ $item[$image_key] ?? '' }}"
selected="{{ (in_array($item[$value_key], $selected_value)) ? 'true' : 'false' }}" />
selected="{{ (in_array($item[$value_key], $selected_value)) ? 'true' : 'false' }}"/>
@empty
<x-bladewind::select-item
:selectable="false"
Expand Down

0 comments on commit 01db7c0

Please sign in to comment.