ok
Direktori : /home2/selectio/www/limpiar.in.net/app/Utility/ |
Current File : //home2/selectio/www/limpiar.in.net/app/Utility/ProductUtility.php |
<?php namespace App\Utility; use App\Models\Addon; use App\Models\Color; class ProductUtility { public static function get_attribute_options($collection) { $options = array(); if ( isset($collection['colors_active']) && $collection['colors_active'] && $collection['colors'] && count($collection['colors']) > 0 ) { $colors_active = 1; array_push($options, $collection['colors']); } if (isset($collection['choice_no']) && $collection['choice_no']) { foreach ($collection['choice_no'] as $key => $no) { $name = 'choice_options_' . $no; $data = array(); foreach (request()[$name] as $key => $eachValue) { array_push($data, $eachValue); } array_push($options, $data); } } return $options; } public static function get_combination_string($combination, $collection) { $str = ''; foreach ($combination as $key => $item) { if ($key > 0) { $str .= '-' . str_replace(' ', '', $item); } else { if (isset($collection['colors_active']) && $collection['colors_active'] && $collection['colors'] && count($collection['colors']) > 0) { $color_name = Color::where('code', $item)->first()->name; $str .= $color_name; } else { $str .= str_replace(' ', '', $item); } } } return $str; } }