3 namespace BookStack\Access;
5 use BookStack\Access\Notifications\UserInviteNotification;
6 use BookStack\Users\Models\User;
8 class UserInviteService extends UserTokenService
10 protected string $tokenTable = 'user_invites';
11 protected int $expiryTime = 336; // Two weeks
14 * Send an invitation to a user to sign into BookStack
15 * Removes existing invitation tokens.
16 * @throws UserInviteException
18 public function sendInvitation(User $user)
20 $this->deleteByUser($user);
21 $token = $this->createTokenForUser($user);
24 $user->notify(new UserInviteNotification($token));
25 } catch (\Exception $exception) {
26 throw new UserInviteException($exception->getMessage(), $exception->getCode(), $exception);