Globale Live-Suche, Kontaktkarten-Personensuche, neue Beitragsansicht, Termine mit Seitenleiste, Demo-Inhalte, Plugin-Upload-Fix
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m24s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m46s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m31s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m18s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m24s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m46s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m31s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m18s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9b06e65802
commit
b276e1c6d0
211 changed files with 3580 additions and 1072 deletions
|
|
@ -61,9 +61,9 @@ class NewsController extends Controller
|
|||
->visibleTo(request()->user())
|
||||
->with('category')
|
||||
->whereKeyNot($post->id)
|
||||
->when($post->category_id, fn ($query) => $query->where('category_id', $post->category_id))
|
||||
->orderByRaw('category_id = ? DESC', [$post->category_id ?? 0])
|
||||
->latest('published_at')
|
||||
->limit(3)
|
||||
->limit(5)
|
||||
->get()
|
||||
),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use App\Pagebuilder\Blocks;
|
|||
use App\Pagebuilder\BlockType;
|
||||
use App\Pagebuilder\Field;
|
||||
use App\Plugins\Plugin;
|
||||
use App\Search\GlobalSearch;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Navigation;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
|
@ -24,6 +25,8 @@ class NewsPlugin extends Plugin
|
|||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->make(GlobalSearch::class)->add('news', 'Neuigkeiten', 'newspaper', fn (...$args) => app(NewsSearch::class)(...$args), sort: 10);
|
||||
|
||||
$this->app->make(Navigation::class)->add('news', 'Neuigkeiten', '/neuigkeiten', active: ['news.index', 'news.show'], sort: 20);
|
||||
|
||||
$abilities = $this->app->make(Abilities::class);
|
||||
|
|
|
|||
28
plugins-core/news/src/NewsSearch.php
Normal file
28
plugins-core/news/src/NewsSearch.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\News;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Search\GlobalSearch;
|
||||
use Inhaus\Plugins\News\Models\NewsPost;
|
||||
|
||||
/** Suchquelle für die globale Suche */
|
||||
class NewsSearch
|
||||
{
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function __invoke(User $user, string $search, int $limit): array
|
||||
{
|
||||
$query = NewsPost::query()->published()->visibleTo($user)->with('category');
|
||||
GlobalSearch::whereTerms($query, ['title', 'teaser', 'body'], $search);
|
||||
|
||||
return $query->latest('published_at')->limit($limit)->get()->map(fn (NewsPost $post) => [
|
||||
'title' => $post->title,
|
||||
'url' => route('news.show', $post->slug),
|
||||
'excerpt' => GlobalSearch::excerpt($post->teaser.' '.$post->body_html, $search),
|
||||
'meta' => collect([$post->category?->name, $post->published_at?->translatedFormat('j. F Y')])->filter()->implode(' · '),
|
||||
'image' => $post->coverUrl('thumb'),
|
||||
])->all();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue