Plugin-System; Neuigkeiten und Termine als mitgelieferte Plugins
- Plugins nach WordPress-Prinzip: plugin.json-Manifest mit Versions- und Abhängigkeitsprüfung, eigenes PSR-4-Autoloading, register()/boot(), activate()/deactivate()/uninstall(), Migrationen, Routen und Views je Plugin - plugins-core/ (mitgeliefert, aktiv bis zur Deaktivierung) und plugins/ (Kunden-Plugins, geschützt vor Updates, inaktiv bis zur Aktivierung) - Zustand in storage/app/plugins.json – Laden ohne Datenbankabfrage - Wiederherstellungsmodus: Ausnahmen und Fatal Errors beim Laden deaktivieren das Plugin, das Portal bleibt erreichbar - Hooks (Actions/Filter mit Prioritäten) und Registries für Navigation, Startseiten-Kacheln, Rechte und Admin-Seiten (Filament-Discovery) - Admin-Seite „Plugins“: aktivieren, deaktivieren, per ZIP installieren (ZIP-Slip-Schutz), löschen mit oder ohne Daten; abschaltbar per INHAUS_DISALLOW_FILE_MODS - Startseite komplett aus Kacheln; Plugin-Seiten als „slug::Seite“ - Version 0.3.0 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cc0020458f
commit
28ef1e4a20
155 changed files with 2762 additions and 573 deletions
|
|
@ -2,59 +2,17 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Resources\EventResource;
|
||||
use App\Http\Resources\NewsPostResource;
|
||||
use App\Http\Resources\PersonResource;
|
||||
use App\Models\Event;
|
||||
use App\Models\NewsPost;
|
||||
use App\Models\User;
|
||||
use App\Support\QuickLinks;
|
||||
use App\Dashboard\Widgets;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, QuickLinks $quickLinks): Response
|
||||
public function __invoke(Request $request, Widgets $widgets): Response
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
// Hervorgehobene Beiträge für den Slider; ohne Hervorhebung die neuesten mit Bild.
|
||||
$featured = NewsPost::query()->published()->with('category')
|
||||
->where('is_featured', true)->whereNotNull('cover_path')
|
||||
->latest('published_at')->limit(5)->get();
|
||||
|
||||
if ($featured->isEmpty()) {
|
||||
$featured = NewsPost::query()->published()->with('category')
|
||||
->whereNotNull('cover_path')->latest('published_at')->limit(3)->get();
|
||||
}
|
||||
|
||||
$recent = NewsPost::query()->published()->with('category')
|
||||
->whereKeyNot($featured->modelKeys())
|
||||
->latest('published_at')->limit(8)->get();
|
||||
|
||||
return Inertia::render('Dashboard', [
|
||||
'profile' => [
|
||||
'job_title' => $user->job_title,
|
||||
'department' => $user->department,
|
||||
'location' => $user->location,
|
||||
'avatar_url' => $user->avatarUrl(256),
|
||||
],
|
||||
'quickLinks' => $quickLinks->all(),
|
||||
'featuredNews' => NewsPostResource::collection($featured),
|
||||
'latestNews' => NewsPostResource::collection($recent->take(4)->values()),
|
||||
'moreNews' => NewsPostResource::collection($recent->slice(4)->values()),
|
||||
'upcomingEvents' => EventResource::collection(Event::query()->upcoming()->limit(4)->get()),
|
||||
'newColleagues' => PersonResource::collection(
|
||||
User::query()
|
||||
->active()
|
||||
->whereKeyNot($user->getKey())
|
||||
->where('created_at', '>=', now()->subDays(90))
|
||||
->latest()
|
||||
->limit(6)
|
||||
->get()
|
||||
),
|
||||
'peopleCount' => User::query()->active()->count(),
|
||||
'widgets' => $widgets->resolve($request->user(), $request),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Resources\EventResource;
|
||||
use App\Models\Event;
|
||||
use App\Support\Branding;
|
||||
use App\Support\Calendar;
|
||||
use Illuminate\Http\Response as HttpResponse;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class EventController extends Controller
|
||||
{
|
||||
public function index(): Response
|
||||
{
|
||||
return Inertia::render('Events/Index', [
|
||||
'events' => EventResource::collection(
|
||||
Event::query()->upcoming()->limit(200)->get()
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(Event $event): Response
|
||||
{
|
||||
abort_unless($event->is_published, 404);
|
||||
|
||||
return Inertia::render('Events/Show', [
|
||||
'event' => [
|
||||
...(new EventResource($event))->resolve(),
|
||||
'description_html' => $event->description_html,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function ics(Event $event, Calendar $calendar, Branding $branding): HttpResponse
|
||||
{
|
||||
abort_unless($event->is_published, 404);
|
||||
|
||||
return response($calendar->toIcs($event, $branding->portalName()), 200, [
|
||||
'Content-Type' => 'text/calendar; charset=utf-8',
|
||||
'Content-Disposition' => 'attachment; filename="termin-'.$event->id.'.ics"',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Resources\NewsPostResource;
|
||||
use App\Models\NewsCategory;
|
||||
use App\Models\NewsPost;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class NewsController extends Controller
|
||||
{
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$categories = NewsCategory::query()->orderBy('sort')->orderBy('name')->get(['id', 'name', 'slug']);
|
||||
$category = $categories->firstWhere('slug', $request->query('kategorie'));
|
||||
|
||||
$posts = NewsPost::query()
|
||||
->published()
|
||||
->with('category')
|
||||
->when($category, fn ($query) => $query->where('category_id', $category->id))
|
||||
->latest('published_at')
|
||||
->paginate(12)
|
||||
->withQueryString();
|
||||
|
||||
return Inertia::render('News/Index', [
|
||||
'posts' => NewsPostResource::collection($posts),
|
||||
'categories' => $categories->map(fn (NewsCategory $c) => ['name' => $c->name, 'slug' => $c->slug]),
|
||||
'activeCategory' => $category?->slug,
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(NewsPost $post): Response
|
||||
{
|
||||
abort_unless($post->isPublished(), 404);
|
||||
|
||||
$post->load(['category', 'author']);
|
||||
|
||||
return Inertia::render('News/Show', [
|
||||
'post' => [
|
||||
...(new NewsPostResource($post))->resolve(),
|
||||
'body_html' => $post->body_html,
|
||||
'author' => $post->author ? [
|
||||
'id' => $post->author->id,
|
||||
'name' => $post->author->name,
|
||||
'initials' => $post->author->initials,
|
||||
'job_title' => $post->author->job_title,
|
||||
'avatar_url' => $post->author->avatarUrl(96),
|
||||
] : null,
|
||||
],
|
||||
'related' => NewsPostResource::collection(
|
||||
NewsPost::query()
|
||||
->published()
|
||||
->with('category')
|
||||
->whereKeyNot($post->id)
|
||||
->when($post->category_id, fn ($query) => $query->where('category_id', $post->category_id))
|
||||
->latest('published_at')
|
||||
->limit(3)
|
||||
->get()
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue