Last active
August 21, 2017 21:55
-
-
Save bayareawebpro/51a98f83d12c5d4f63849554f4569a90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$user = User::first($id) | |
//Generate Token | |
do { | |
$token = str_random(128); | |
} while (User::where('token', $token)->exists()); | |
$user->token = $token; | |
$user->save(); | |
//Check Token | |
if(User::where('token', $token)->exists()){ | |
$user = User::where('token', $token)->first(); | |
//Do Something | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment