for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class WorldResource extends JsonResource
{
public function toArray($request)
$data = [
'id' => $this->id,
id
App\Http\Resources\WorldResource
__get
'map_id' => $this->map_id,
map_id
'display_name' => $this->display_name,
display_name
'year' => $this->year,
year
];
if ($this->investors_count !== null) {
investors_count
$data['investors'] = $this->investors_count;
}
if ($this->online_count !== null) {
online_count
$data['online'] = $this->online_count;
if ($this->updated_at !== null) {
updated_at
$data['updated_at'] = $this->updated_at->format('Y-m-d H:i:s');
return $data;