PHP code example of mathewparet / laravelinvites

1. Go to this page and download the library: Download mathewparet/laravelinvites 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/ */

    

mathewparet / laravelinvites example snippets


// config/app.php
'providers' => [
    ...
    mathewparet\LaravelInvites\LaravelInvitesServiceProvider::class,
];

// config/app.php
'aliases' => [
    ...
    'LaravelInvites' => mathewparet\LaravelInvites\Facades\LaravelInvites::class
];

LaravelInvites::generate();

LaravelInvites::generate(10); // generates 10 different invitation codes

LaravelInvites::withoutExpiry()->generate();

$date = Carbon\Carbon::now()->addDays(5);
LaravelInvites::setExpiry($date)->generate();
// generates an invitation code that expires in 5 days

$date = Carbon\Carbon::now()->addDays(5);
LaravelInvites::notBefore($date)->generate();
// generates an invitation code that can be used only after 5 days

$date = Carbon\Carbon::now()->addDays(5);
LaravelInvites::validFrom($date)->generate();
// generates an invitation code that can be used only after 5 days

LaravelInvites::for('[email protected]')->generate();
// This code can be used only by [email protected]

LaravelInvites::generateFor('[email protected]');

LaravelInvites::isValid($code);

LaravelInvites::isValid($code, $email);

LaravelInvites::check($code, $email);

LaravelInvites::check($code);

LaravelInvites::redeem($code, $email);

LaravelInvites::redeem($code);

LaravelInvites::get();

LaravelInvites::for('[email protected]')->get();

public function store(Request $request)
{
    $request->validate([
        'email' => 'he email id
    ]);

    // Add the user to the database.
}
 artisan invites:generate
bash
php artisan migrate
bash
php artisan vendor:publish --provider="\mathewparet\LaravelInvites\LaravelInvitesServiceProvider" --tag=config
config/laravelinvites.php
bash
php artisan invites:generate
bash
php artisan invites:cleanup
bash
php artisan invites:check