Answers for "laravel random string unique"

PHP
0

Laravel Generate Random Unique Number Example

<?php
  
namespace App\Http\Controllers;
  
class TestController extends Controller
{
    /**
     * Write code on Method
     *
     * @return response()
     */
    public function index()
    {
        $randomNumber = random_int(1000, 9999);
  
        dd($randomNumber);
    }
}
Posted by: Guest on August-30-2021
0

laravel generate unique db token

do {
    $token_id = makeRandomToken();
    $token_key = makeRandomTokenKey();
} while (User::where("token_id", "=", $token_id)->where("token_key", "=", $token_key)->first() instanceof User);
Posted by: Guest on September-23-2020

Code answers related to "laravel random string unique"

Browse Popular Code Answers by Language