clarkeash / doorman

Limit access to your Laravel applications by using invite codes
https://packagist.org/packages/clarkeash/doorman
MIT License
1.02k stars 45 forks source link

check invite code without email #32

Closed mehrdad-shokri closed 6 years ago

mehrdad-shokri commented 6 years ago

I have generated an invite code for an email. Now I just want that if a givven invite code is available( is not expired, is not used yet, etc.) without passing the associated email.
Is there any method for doing so?
The purpose behind this is that I email invite codes generated for that email so asking for email is redundant.
Also, I want to find associated email instead of asking them.
The question is how to validate invite codes without passing email address?

clarkeash commented 6 years ago

You could use the Invite model.

use Clarkeash\Doorman\Models\Invite;

$invite = Invite::where('code', 'ENTER INVITE CODE HERE')->firstOrFail();
$email = $invite->for; // could be null

Does this help at all?

mehrdad-shokri commented 6 years ago

yep, copied some method sources to the controller since it's protected and cant be called from the facade.
Why you Str::toUpper invite code when looking up for invite code in the source code?