Files
solidtime/app/Http/Resources/V1/Member/PersonalMembershipResource.php
Constantin Graf f01a4111b6 Fix Scramble API docs warnings
Remove redundant @var annotations from API resources and defer the user
access in the email unique rule of UserUpdateRequest, so rules() can be
evaluated by Scramble without route model binding. Add a test that fails
on any Scramble diagnostic and tests for the email unique rule.
2026-10-08 16:39:46 +02:00

39 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Resources\V1\Member;
use App\Http\Resources\V1\BaseResource;
use App\Models\Member;
use Illuminate\Http\Request;
/**
* @property Member $resource
*/
class PersonalMembershipResource extends BaseResource
{
/**
* Transform the resource into an array.
*
* @return array<string, string|bool|int|null|array<string>>
*/
public function toArray(Request $request): array
{
return [
/** ID of membership */
'id' => $this->resource->id,
'organization' => [
/** ID of organization */
'id' => $this->resource->organization->id,
/** Name of organization */
'name' => $this->resource->organization->name,
/** Currency code (ISO 4217) of organization */
'currency' => $this->resource->organization->currency,
],
/** Role */
'role' => $this->resource->role,
];
}
}