-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanDetailsResource.php
More file actions
47 lines (42 loc) · 1.27 KB
/
ScanDetailsResource.php
File metadata and controls
47 lines (42 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
declare(strict_types=1);
namespace App\Http\Resources;
use App\Models\Scan;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @mixin Scan
*/
class ScanDetailsResource extends JsonResource
{
public static $wrap;
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'uuid' => $this->getUuid(),
'url' => $this->url,
'status' => $this->status,
'createdAt' => $this->created_at,
'scores' => [
'clarity' => $this->clarity_score,
'consistency' => $this->consistency_score,
'seo' => $this->seo_score,
'tone' => $this->tone_score,
],
'analysis' => [
'clarity' => $this->clarity_analysis,
'consistency' => $this->consistency_analysis,
'seo' => $this->seo_analysis,
'tone' => $this->tone_analysis,
],
'suggestions' => [
'headlines' => $this->suggested_headlines ?? [],
'ctas' => $this->suggested_ctas ?? [],
'hierarchy' => $this->suggested_content_hierarchy ?? [],
],
];
}
}