2FAuth/app/Api/v1/Resources/GroupResource.php

29 lines
651 B
PHP
Raw Normal View History

<?php
namespace App\Api\v1\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @property mixed $id
* @property string $name
* @property int|null $twofaccounts_count
*/
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,
];
}
2022-11-22 15:15:52 +01:00
}