38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ToolResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'slug' => $this->slug,
|
|
'description' => $this->description,
|
|
'url' => $this->url,
|
|
'logo_url' => $this->logo_url,
|
|
'category' => $this->category,
|
|
'category_label' => $this->category_label,
|
|
'subcategory' => $this->subcategory,
|
|
'tags' => $this->tags,
|
|
'pricing' => $this->pricing,
|
|
'features' => $this->features,
|
|
'views' => $this->views,
|
|
'clicks' => $this->clicks,
|
|
'featured' => $this->featured,
|
|
'approved' => $this->approved,
|
|
'submitted_by' => new UserResource($this->whenLoaded('user')),
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|