66 lines
1.7 KiB
PHP
66 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class HitcountResource extends JsonResource
|
|
{
|
|
/**
|
|
* @OA\Schema(
|
|
* schema="HitcountResource",
|
|
* type="object",
|
|
* title="Hitcount",
|
|
* description="Hitcount resource",
|
|
* @OA\Property(
|
|
* property="id",
|
|
* type="integer",
|
|
* example=1
|
|
* ),
|
|
* @OA\Property(
|
|
* property="ip",
|
|
* type="string",
|
|
* example="127.0.0.1"
|
|
* ),
|
|
* @OA\Property(
|
|
* property="device_type",
|
|
* type="string",
|
|
* example="desktop"
|
|
* ),
|
|
* @OA\Property(
|
|
* property="user_agent",
|
|
* type="string",
|
|
* example="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0"
|
|
* ),
|
|
* @OA\Property(
|
|
* property="country",
|
|
* type="string",
|
|
* example="Japan"
|
|
* ),
|
|
* @OA\Property(
|
|
* property="url",
|
|
* type="string",
|
|
* example="https://my-application.com"
|
|
* ),
|
|
* @OA\Property(
|
|
* property="created_at",
|
|
* type="string",
|
|
* format="date-time",
|
|
* example="2025-11-10T17:45:00.000000Z"
|
|
* )
|
|
* )
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'ip' => $this->ip,
|
|
'device_type' => $this->device_type,
|
|
'user_agent' => $this->user_agent,
|
|
'country' => $this->country,
|
|
'url' => $this->url
|
|
];
|
|
}
|
|
}
|