[ 'type' => 'String!', 'description' => 'The URL key of the page', ], ], paginationEnabled: false, resolver: PageByUrlKeyResolver::class, ), ], )] class Page extends BasePage { /** * Get unique page identifier for API Platform */ #[ApiProperty(identifier: true, writable: false)] public function getId(): int { return (int) $this->id; } /** * Get layout */ #[ApiProperty(writable: false, readable: true)] public function getLayout(): ?string { return $this->layout; } /** * Get created at */ #[ApiProperty(writable: false, readable: true)] public function getCreatedAt(): ?\DateTime { return $this->created_at; } /** * Get updated at */ #[ApiProperty(writable: false, readable: true)] public function getUpdatedAt(): ?\DateTime { return $this->updated_at; } /** * Get current locale translation for API */ #[ApiProperty(readable: true, writable: false, description: 'Current locale translation')] public function getCurrentTranslation(): ?\Illuminate\Database\Eloquent\Model { return $this->translations->firstWhere('locale', app()->getLocale()) ?? $this->translations->first(); } }