init
This commit is contained in:
27
app/Http/Resources/WeatherDataResource.php
Normal file
27
app/Http/Resources/WeatherDataResource.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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,
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user