Manage redirects, missing URLs, repositories and settings through the API
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
35
app/Http/Resources/MissingUrlResource.php
Normal file
35
app/Http/Resources/MissingUrlResource.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\MissingUrl;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin MissingUrl
|
||||
*/
|
||||
class MissingUrlResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'path' => $this->path,
|
||||
'locale' => $this->locale,
|
||||
'referrer' => $this->referrer,
|
||||
// Our own page links here: more urgent than someone else's stale link.
|
||||
'internal_referrer' => $this->resource->isInternalReferrer(),
|
||||
'status' => $this->status->value,
|
||||
'hits' => (int) $this->hits,
|
||||
'first_seen_at' => $this->first_seen_at?->toIso8601String(),
|
||||
'last_seen_at' => $this->last_seen_at?->toIso8601String(),
|
||||
'resolved_at' => $this->resolved_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user