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:
53
app/Http/Resources/PublicApi/PublicCallResource.php
Normal file
53
app/Http/Resources/PublicApi/PublicCallResource.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\PublicApi;
|
||||
|
||||
use App\Models\Call;
|
||||
use App\Support\SiteUrls;
|
||||
use App\Support\TranslatablePayload;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Call
|
||||
*/
|
||||
class PublicCallResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$locale = app()->getLocale();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'locale' => $locale,
|
||||
|
||||
...TranslatablePayload::resolve(
|
||||
$this->resource,
|
||||
['title', 'slug', 'description', 'what_you_get'],
|
||||
$locale,
|
||||
),
|
||||
|
||||
'status' => $this->status->value,
|
||||
|
||||
// The numbers that let someone decide in ten seconds. Time is the
|
||||
// scarce resource here, not money.
|
||||
'hours_per_week' => $this->hours_per_week,
|
||||
'duration_weeks' => $this->duration_weeks,
|
||||
'total_hours' => $this->totalHours(),
|
||||
'seniority' => $this->seniority,
|
||||
|
||||
'closes_at' => $this->closes_at?->toDateString(),
|
||||
|
||||
'project' => PublicProjectResource::make($this->whenLoaded('project')),
|
||||
'technologies' => PublicTechnologyResource::collection($this->whenLoaded('technologies')),
|
||||
|
||||
'alternates' => SiteUrls::alternates($this->resource, 'call'),
|
||||
'path' => SiteUrls::alternates($this->resource, 'call')[$locale] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user