@php $belongsToLaw = $structure->law_id == $law->id; $repeal = $structure->repealedBy; $newLaw = $structure->newLaw; $isRepealed = $structure->repealed && $repeal; $label = $structure->structureType ? $structure->structureType->abrev . ' ' . ($structure->order_label ?? '') : ($structure->order_label ?? ''); $children = $structure->children->filter(fn($child) => $child->law_id == $law->id); $addedArticles = \App\Models\Structure::where(function($query) use ($structure, $law) { $query->where('structure_id', $structure->id) ->orWhere('parent_id', $structure->id); }) ->where('law_id', $law->id) ->orderBy('order') ->get(); $allChildren = $children->merge($addedArticles)->unique('id')->sortBy('order'); @endphp @if($belongsToLaw)
  • {{ $label }} @if($isRepealed)
    {!! $structure->content !!} @if($repeal && $repeal->newLaw) @endif
    @elseif($structure->added_to_other_law && $newLaw) {!! $structure->content !!} @else {!! $structure->content !!} @endif
    @csrf @method('DELETE')
  • @endif