@if($data->count()) @foreach($data as $key => $value)
@php $route_context = $route_inline = null; $context_menu = isset($context_menu) ? $context_menu : []; $hyperlink_menu = isset($hyperlink_menu) ? $hyperlink_menu : []; if($config_type === 'model') { $col_array = $value->attributesToArray(); } else { $col_array= get_object_vars($value); } $col_array_actual = $col_array; if(count($context_menu)>0 ){ foreach($context_menu as $menu){ $extracted_url = explode("{",$menu->route_name); $extract_string = strchr($menu->route_name,"{"); $modified_text = strtr($extract_string, $col_array); $route_context = preg_replace('/[{}]/', '', $modified_text); $route_context = $extracted_url[0].$route_context; } } $checked_value = $colom_val_criteria = null; $first_col = array_keys($col_array_actual)[0]; $second_col = array_keys($col_array_actual)[1]; @endphp
@php $html = ""; $html_settings = $html_date_format = []; foreach($card_view_settings as $key_setting => $setting_row){ if(isset($setting_row['html'])){ $html = $setting_row['html']; continue; } if(isset($setting_row['settings'])){ $html_settings = $setting_row['settings']; continue; } if(isset($setting_row['date_format'])){ $html_date_format = $setting_row['date_format']; continue; } } $pattern = '/\{([^}]+)\}/'; $html = preg_replace_callback($pattern, function($matches) use ($key,$data,$html_settings,$html_date_format) { $val = $matches[1]; $check_val = $data[$key]->$val; foreach ($html_settings as $outerKey => $outerValue) { foreach ($outerValue as $innerKey => $innerValue) { if($innerKey != $val) continue; foreach ($innerValue as $statusName => $color) { if(isset($color[$check_val]) && $val == $innerKey){ return ''.$check_val.''; } } } } foreach ($html_date_format as $dateKey => $dateValue) { foreach($dateValue as $date_col => $date_field) { if($date_col == $val){ //return $check_val; return TableBuilderHelper::formatTimeAgo($check_val); //format_date($check_val); } } } if(isset($data[$key]->$val)){ return $data[$key]->$val; } }, $html); echo $html; @endphp
@endforeach @else {{'No Data Found'}} @endif