28 lines
737 B
PHP
28 lines
737 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class WeatherDataResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'currentTemperature' => $this->current_temperature,
|
|
'weatherIcon' => $this->weather_icon,
|
|
'weatherDescription' => $this->weather_description,
|
|
'windSpeed' => $this->wind_speed,
|
|
'windDir' => $this->wind_dir,
|
|
'localtimeEpoch' => $this->localtime_epoch,
|
|
];
|
|
|
|
}
|
|
}
|