Wire admin studio SSR and search infrastructure
This commit is contained in:
@@ -37,8 +37,12 @@ class PostSearchController extends Controller
|
||||
->where('status', Post::STATUS_PUBLISHED)
|
||||
->paginate($perPage, 'page', $page);
|
||||
|
||||
// Load relations
|
||||
$results->load($this->feedService->publicEagerLoads());
|
||||
if ($viewerId) {
|
||||
$results->getCollection()->loadExists([
|
||||
'saves as viewer_saved' => fn ($saveQuery) => $saveQuery->where('user_id', $viewerId),
|
||||
]);
|
||||
}
|
||||
|
||||
$formatted = $results->getCollection()
|
||||
->map(fn ($post) => $this->feedService->formatPost($post, $viewerId))
|
||||
@@ -57,6 +61,9 @@ class PostSearchController extends Controller
|
||||
} catch (\Exception $e) {
|
||||
// Fallback: basic LIKE search on body
|
||||
$paginated = Post::with($this->feedService->publicEagerLoads())
|
||||
->withExists([
|
||||
'saves as viewer_saved' => fn ($saveQuery) => $saveQuery->where('user_id', $viewerId),
|
||||
])
|
||||
->where('status', Post::STATUS_PUBLISHED)
|
||||
->where('visibility', Post::VISIBILITY_PUBLIC)
|
||||
->where(function ($q) use ($query) {
|
||||
|
||||
Reference in New Issue
Block a user