Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
<?php
namespace HiEvents\Http\Actions\Accounts;
use HiEvents\DomainObjects\Enums\Permission;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Http\Attributes\RequiresPermission;
use HiEvents\Http\Request\Account\UpdateAccountRequest;
use HiEvents\Resources\Account\AccountResource;
use HiEvents\Services\Application\Handlers\Account\DTO\UpdateAccountDTO;
use HiEvents\Services\Application\Handlers\Account\UpdateAccountHanlder;
use Illuminate\Http\JsonResponse;
#[RequiresPermission(Permission::MANAGE_ACCOUNT)]
class UpdateAccountAction extends BaseAction
{
private UpdateAccountHanlder $updateAccountHandler;
public function __construct(UpdateAccountHanlder $updateAccountHandler)
{
$this->updateAccountHandler = $updateAccountHandler;
}
public function __invoke(UpdateAccountRequest $request): JsonResponse
{
$authUser = $this->getAuthenticatedUser();
$payload = array_merge($request->validated(), [
'account_id' => $this->getAuthenticatedAccountId(),
'updated_by_user_id' => $authUser->getId(),
]);
$account = $this->updateAccountHandler->handle(UpdateAccountDTO::fromArray($payload));
return $this->resourceResponse(AccountResource::class, $account);
}
}