@if(count($combinations[0]) > 0) @foreach ($combinations as $key => $combination) @php $sku = ''; foreach (explode(' ', $product_name) as $key => $value) { $sku .= substr($value, 0, 1); } $str = ''; foreach ($combination as $key => $item){ if($key > 0 ){ $str .= '-'.str_replace(' ', '', $item); $sku .='-'.str_replace(' ', '', $item); } else{ if($colors_active == 1){ $color_name = \App\Color::where('code', $item)->first()->name; $str .= $color_name; $sku .='-'.$color_name; } else{ $str .= str_replace(' ', '', $item); $sku .='-'.str_replace(' ', '', $item); } } } @endphp @if(strlen($str) > 0) @php $explode = explode("-", $str); $skuval = array(); foreach($explode as $val){ if(!empty($val)){ $skuval[] = substr($val, 0,1); } } $skuval = (implode('', $skuval)); $random = rand(1000,9999); @endphp @endif @endforeach
@endif