]> BookStack Code Mirror - bookstack/blob - app/Auth/Access/UserInviteService.php
Start user invite system
[bookstack] / app / Auth / Access / UserInviteService.php
1 <?php namespace BookStack\Auth\Access;
2
3 use BookStack\Auth\User;
4 use BookStack\Notifications\UserInvite;
5
6 class UserInviteService extends UserTokenService
7 {
8     protected $tokenTable = 'user_invites';
9     protected $expiryTime = 336; // Two weeks
10
11     /**
12      * Send an invitation to a user to sign into BookStack
13      * Removes existing invitation tokens.
14      * @param User $user
15      */
16     public function sendInvitation(User $user)
17     {
18         $this->deleteByUser($user);
19         $token = $this->createTokenForUser($user);
20         $user->notify(new UserInvite($token));
21     }
22
23 }