@extends('layouts.frontend') @section('title') {{ $author->name }} @endsection @section('content')

{{ $author->name }}

@if($author->birth_date || $author->death_date)

@if($author->birth_date) {{ $author->birth_date->format('d M Y') }} @endif @if($author->birth_date && $author->death_date) — @endif @if($author->death_date) {{ $author->death_date->format('d M Y') }} @endif

@endif @if($author->description)
{!! $author->description !!}
@endif

Total {{ $books->sum(fn($v) => $v->count()) }} buku ({{ count($books) }} judul)

@foreach ($books as $title => $versions) @php $firstBook = $versions->first(); $versionCount = $versions->count(); @endphp
@if($versionCount > 1) {{ $title }} @else {{ $title }} @endif
@if($versionCount > 1) {{ $title }} @else {{ $title }} @endif
@if($versionCount > 1)
{{ $versionCount }} Jilid
@endif @if($firstBook->categories->count())

@foreach($firstBook->categories as $category) {{ $category->name }} @endforeach

@endif
@if($versionCount > 1) @endif @endforeach
@endsection