38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
@extends('layouts.nova')
|
|
|
|
@php
|
|
$threadsData = collect($subtopics->items())->map(fn ($sub) => [
|
|
'topic_id' => (int) ($sub->topic_id ?? $sub->id ?? 0),
|
|
'topic' => $sub->topic ?? $sub->title ?? 'Untitled',
|
|
'discuss' => $sub->discuss ?? null,
|
|
'num_posts' => (int) ($sub->num_posts ?? 0),
|
|
'uname' => $sub->uname ?? 'Unknown',
|
|
'last_update' => $sub->last_update ?? $sub->post_date ?? null,
|
|
'is_pinned' => $sub->is_pinned ?? false,
|
|
])->values();
|
|
|
|
$paginationData = (isset($subtopics) && method_exists($subtopics, 'currentPage'))
|
|
? [
|
|
'current_page' => $subtopics->currentPage(),
|
|
'last_page' => $subtopics->lastPage(),
|
|
'per_page' => $subtopics->perPage(),
|
|
'total' => $subtopics->total(),
|
|
] : null;
|
|
|
|
$forumCategoryProps = json_encode([
|
|
'category' => ['id' => $category->id ?? null, 'name' => $category->name ?? '', 'slug' => $category->slug ?? ''],
|
|
'threads' => $threadsData,
|
|
'pagination' => $paginationData,
|
|
'isAuthenticated' => auth()->check(),
|
|
], JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
|
@endphp
|
|
|
|
@section('content')
|
|
<div id="forum-category-root"></div>
|
|
<script type="application/json" id="forum-category-props">{!! $forumCategoryProps !!}</script>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
@vite(['resources/js/entry-forum.jsx'])
|
|
@endpush
|