@extends('layouts.main')

@section('content')
    <table class="table table-compact table-striped">
        <thead>
            <th>Name</th>
            <th>Authors</th>
            <th>Location</th>
            <th>Actions</th>
        </thead>
        <tbody>
            @foreach ($rows as $row)
                <tr>
                    <td>{{ $row->name }}</td>
                    <td>{{ $row->authors->pluck('name')->join(', ') }}</td>
                    <td>{{ $row->location->name }}</td>
                    <td>
                        <a class="btn btn-info btn-sm" href="{{ route('books.show', $row->id) }}">View</a>
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
    {{ $rows->links() }}
@endsection