*/ protected function crumbs(string $slug, array $page): array { return ['Beranda' => route('operator.dashboard')] + array_fill_keys(Catalog::trail($slug), null) + [$page['title'] => null]; } /** @return array{rows: list>, page: int, last_page: int, total: int, per_page: int} */ protected function payload(LengthAwarePaginator $rows): array { return [ 'rows' => array_values($rows->items()), 'page' => $rows->currentPage(), 'last_page' => $rows->lastPage(), 'total' => $rows->total(), 'per_page' => $rows->perPage(), ]; } /** Hanya akun DB lama yang memegang data asli; akun demo mendapat 404 (halamannya prototipe). */ protected function legacyOnly(Request $request): void { abort_unless($request->user() instanceof Account, 404); } /** @param list $allowed */ protected function perPage(Request $request, array $allowed): int { return in_array($request->integer('per'), $allowed, true) ? $request->integer('per') : $allowed[0]; } protected function query(Request $request): string { $q = $request->input('q'); return is_string($q) ? mb_substr(trim($q), 0, 100) : ''; } }