Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
43
app/Http/Resources/PublicApi/PublicTalkResource.php
Normal file
43
app/Http/Resources/PublicApi/PublicTalkResource.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\PublicApi;
|
||||
|
||||
use App\Models\Talk;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Talk
|
||||
*/
|
||||
class PublicTalkResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$locale = app()->getLocale();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
||||
// Not translated: it is the name of a talk that was given once, in
|
||||
// one language. `language` says which.
|
||||
'title' => $this->title,
|
||||
'language' => $this->language,
|
||||
|
||||
'summary' => $this->getTranslation('summary', $locale, false) ?: null,
|
||||
|
||||
'event' => $this->event,
|
||||
'city' => $this->city,
|
||||
'held_at' => $this->held_at?->toDateString(),
|
||||
|
||||
'video_url' => $this->video_url,
|
||||
'slides_url' => $this->slides_url,
|
||||
|
||||
'speaker' => PublicMemberResource::make($this->whenLoaded('member')),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user