@php $editing = isset($offer) && $offer; $rows = old('items', $editing ? $offer->items->map(fn($item) => [ 'price_list_item_id' => $item->price_list_item_id, 'description' => $item->description, 'quantity' => $item->quantity, 'unit' => $item->unit, 'unit_price' => $item->unit_price, ])->all() : [['price_list_item_id'=>'','description'=>'Ručna stavka','quantity'=>1,'unit'=>'emitiranje','unit_price'=>0]]); $value = fn($name, $default = '') => old($name, $editing ? $offer->$name : $default); @endphp