mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-22 05:54:14 +00:00
44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Accounts\Services;
|
|
|
|
|
|
use App\Classes\common;
|
|
use App\Classes\Modules\Accounts\DataTransferObjects\UserInvitationObject;
|
|
use App\Classes\Modules\Accounts\Exceptions\InvitationAlreadyExistsException;
|
|
use App\Models\UserInvitation;
|
|
|
|
final class CreatesUserInvitation
|
|
{
|
|
|
|
/** @var UserInvitation */
|
|
private $repository;
|
|
|
|
/**
|
|
* CreatesUserInvitation constructor.
|
|
* @param UserInvitation $repository
|
|
*/
|
|
public function __construct(UserInvitation $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param UserInvitationObject $object
|
|
* @return UserInvitation|null
|
|
*/
|
|
public function execute(UserInvitationObject $object): ?UserInvitation {
|
|
$model = $this->repository->create([
|
|
'email' => $object->getInviteeEmail(),
|
|
'hash' => $object->getHash(),
|
|
'role_id' => $object->getRole(),
|
|
'sender_id' => auth()->user()->getAuthIdentifier(),
|
|
'is_complete' => false,
|
|
]);
|
|
|
|
return $model;
|
|
|
|
}
|
|
|
|
} |