mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-09 22:33:18 +01:00
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.
33 lines
739 B
PHP
33 lines
739 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources\V1\Invitation;
|
|
|
|
use App\Http\Resources\V1\BaseResource;
|
|
use App\Models\OrganizationInvitation;
|
|
use Illuminate\Http\Request;
|
|
|
|
/**
|
|
* @property OrganizationInvitation $resource
|
|
*/
|
|
class InvitationResource 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 the invitation */
|
|
'id' => $this->resource->id,
|
|
/** Email */
|
|
'email' => $this->resource->email,
|
|
/** Role */
|
|
'role' => $this->resource->role,
|
|
];
|
|
}
|
|
}
|