Ниже мой контроллер
Контроллер
Код: Выделить всё
$purchase_order_items = PurchaseOrderBulkItem::where('po_bulk_id', $this->purchase_order_bulk_id)
->orderBy('id', 'asc')
->get()->toArray();
$this->items_count = [];
foreach ($purchase_order_items as $key => $value) {
$i = 0;
$this->items_count[] += $key;
// $this->purchase_order_items[$key]['product_bulk_id'] = $value['product_bulk_id'];
$this->purchase_order_items[$key]['product_item_id'] = $value['product_item_id'];
// $temp_product = ProductsServicesBulk::where('id', $value['product_bulk_id'])->where('company_id', Auth::user()->company_id)->first();
$temp_product_item = ProductsServicesLists::where('id', $value['product_item_id'])->where('company_id', Auth::user()->company_id)->first();
// $this->purchase_order_items[$key]['selected_product_bulk'] = $temp_product->code." : ".$temp_product->name;
$this->purchase_order_items[$key]['product_service_bulk'] = '';
$this->purchase_order_items[$key]['selected_product_item'] = $temp_product_item->name." : ".$temp_product_item->code;
$this->purchase_order_items[$key]['dr_number'] = '';
$this->purchase_order_items[$key]['plate_number'] = '';
$this->purchase_order_items[$key]['length'] = '';
$this->purchase_order_items[$key]['length_display'] = '';
$this->purchase_order_items[$key]['width'] = '';
$this->purchase_order_items[$key]['width_display'] = '';
$this->purchase_order_items[$key]['height'] = 0.00;
$this->purchase_order_items[$key]['total_volume'] = $value['volume'];
$this->purchase_order_items[$key]['total_volume_display'] = number_format($value['volume'],2);
$this->purchase_order_items[$key]['remaining_volume'] = $value['remaining_volume'];
$this->purchase_order_items[$key]['total_received_volume'] = 0;
$this->purchase_order_items[$key]['total_received_volume_display'] = 0;
$name = "purchase_order_items_".$key;
$this->{$name} = [];
$this->{$name}[$key]['index'] = 0;
$this->{$name}[$key]['product_service_bulk'] = '';
$this->{$name}[$key]['selected_product_item'] = $temp_product_item->name." : ".$temp_product_item->code;
$this->{$name}[$key]['dr_number'] = '';
$this->{$name}[$key]['plate_number'] = '';
$this->{$name}[$key]['length'] = '';
$this->{$name}[$key]['length_display'] = '';
$this->{$name}[$key]['width'] = '';
$this->{$name}[$key]['width_display'] = '';
$this->{$name}[$key]['height'] = 0.00;
$this->{$name}[$key]['total_volume'] = $value['volume'];
$this->{$name}[$key]['total_volume_display'] = number_format($value['volume'],2);
$this->{$name}[$key]['remaining_volume'] = $value['remaining_volume'];
$this->{$name}[$key]['total_received_volume'] = 0;
$this->{$name}[$key]['total_received_volume_display'] = 0;
}
Просмотр
Код: Выделить всё
[/i]
Теперь мой вопрос: как мне создать внутри этого динамический метод?
Подробнее здесь: https://stackoverflow.com/questions/788 ... er-of-data
Мобильная версия