2021-09-21 22:46:35 +02:00
|
|
|
<?php
|
|
|
|
|
2021-11-07 21:57:22 +01:00
|
|
|
namespace App\Api\v1\Resources;
|
2021-09-21 22:46:35 +02:00
|
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
2022-09-07 17:54:27 +02:00
|
|
|
/**
|
|
|
|
* @property mixed $id
|
|
|
|
* @property string $name
|
|
|
|
* @property int|null $twofaccounts_count
|
|
|
|
*/
|
2021-09-21 22:46:35 +02:00
|
|
|
class GroupResource extends JsonResource
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the resource into an array.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($request)
|
|
|
|
{
|
|
|
|
return [
|
2022-11-22 15:15:52 +01:00
|
|
|
'id' => $this->id,
|
|
|
|
'name' => $this->name,
|
|
|
|
'twofaccounts_count' => is_null($this->twofaccounts_count) ? 0 : $this->twofaccounts_count,
|
2021-09-21 22:46:35 +02:00
|
|
|
];
|
|
|
|
}
|
2022-11-22 15:15:52 +01:00
|
|
|
}
|