Add Resources
This commit is contained in:
parent
1d2e3b773d
commit
9164a6cd56
|
|
@ -14,6 +14,16 @@ class ClientResource extends JsonResource
|
|||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
// return parent::toArray($request);
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'client_name' => $this->client_name,
|
||||
'access_key' => $this->access_key,
|
||||
'secret_key' => $this->secret_key,
|
||||
'created_at' => (string) $this->created_at,
|
||||
'updated_at' => (string) $this->updated_at,
|
||||
'schedules' => $this->schedules,
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ScheduleResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
// return parent::toArray($request);
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->client_name,
|
||||
'last_backup_status' => $this->access_key,
|
||||
'client' => $this->client->client_name,
|
||||
'client_id' => $this->client->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue