@foreach($customs as $custom)
    <tr>
        <th colspan="2">
            <div class="d-flex justify-content-between">
                <div class="search_target_title">【オリジナル】<br />{{ $custom->name }}</div>
                <span class="search_target">検索</span>
            </div>
        </th>

        <td>
            @switch($custom->type)
                @case(1)
                @php
                    if (isset($article)) {
                        $content = $article->customs()->where("code", $custom->code)->get()->pluck("contents")->toArray();
                    }
                @endphp
                @include('admin.objects.components.checkbox', ['name' => "original[{$custom->code}]", 'checkbox' => $custom->content, "checked" => $content])
                @break
                @case(2)
                @php
                    if (isset($article)) {
                        $content = optional($article->customs()->where("code", $custom->code)->first())->contents;
                    }
                @endphp
                @include('admin.objects.components.selectbox', ['name' => "original[{$custom->code}]", 'options' => $custom->content, 'title' => '未', "selected" => $content])
                @break
                @case(3)
                @php
                    if (isset($article)) {
                        $content = optional($article->customs()->where("code", $custom->code)->first())->contents;
                    }
                @endphp
                @php
                    if($custom->code==7){
                        $new_content = '';
                        $prices = [];
                        foreach($article->histories() as $p){
                            $prices[] = $p->price;
                        }
                        $prices = array_reverse($prices);
                        foreach($prices as $p){
                            if($new_content==''){
                                $new_content = number_format($p, 0) . '万円';
                            }else{
                                $new_content .= ' -> ' . number_format($p, 0) . '万円';
                            }
                        }
                        $content = $new_content;
                    }
                @endphp
                @include('admin.objects.components.textarea', ['name' => "original[{$custom->code}]", 'class' => 'w500', 'count' => 100, 'placeholder' => $custom->content, "value" => $content])
                @break
            @endswitch
        </td>
    </tr>
@endforeach
