Laravel Invite Codes is a package by Mateus Junges that allows you to manage invite codes for your Laravel application easily. It works by configuring a middleware that validates an invite code before accessing a route:
1Route::get('/protected-route', function() {2 //3})->middleware('protected_by_invite_codes');
You can generate an invite code using the following API, restricting this code to a specific user account:
1use \Junges\InviteCodes\Facades\InviteCodes;2 3$invite_code = InviteCodes::create()4 ->expiresAt('2020-02-01')5 ->maxUsages(10)6 ->restrictUsageTo('contato@mateusjunges.com')7 ->save();
You can learn more about this package, get full installation instructions, and view the source code on GitHub at mateusjunges/laravel-invite-codes.