PHP code example of abstem / invites

1. Go to this page and download the library: Download abstem/invites library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abstem / invites example snippets


// config/app.php
'providers' => [
    ...
    Abstem\Invites\InvitesServiceProvider::class,
];

// config/app.php
'aliases' => [
    ...
    'Invites'   =>  Abstem\Invites\Facades\Invites::class,
];

Invites::generate()->make();

Invites::generate()->times(5)->make();

Invites::generate()->uses(10)->make();

$date = Carbon::now('UTC')->addDays(7);
Invites::generate()->expiresOn($date)->make();

Invites::generate()->expiresIn(14)->make();

Invites::redeem('ABCDE');

try {
    Invites::redeem(request()->get('code'), request()->get('email'));
} catch (InvitesException $e) {
    return response()->json(['error' => $e->getMessage()], 422);
}

Invites::check('ABCDE');

return [
    'invite_table_name' => 'invites',
];
bash
$ php artisan migrate
bash
$ php artisan vendor:publish --tag=translations
`messages.php
`messages.php
bash
$ php artisan vendor:publish --tag=config
bash
$ php artisan invites:cleanup