Files
nexusphp/app/Http/Resources/SnatchResource.php

31 lines
845 B
PHP
Raw Normal View History

2021-05-15 19:29:44 +08:00
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class SnatchResource extends PeerResource
{
/**
* Transform the resource into an array.
* @see viewsnatches.php
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
2021-05-17 00:10:15 +08:00
'upload_text' => $this->upload_text,
'download_text' => $this->download_text,
'share_ratio' => $this->share_ratio,
'seed_time' => $this->seed_time,
'leech_time' => $this->leech_time,
'completed_at_human' => $this->completed_at_human,
'last_action_human' => $this->last_action_human,
2021-05-15 19:29:44 +08:00
'user' => new UserResource($this->whenLoaded('user')),
];
}
}