$ipAuth = $_SERVER['REMOTE_ADDR']; $firstName = 'trialMahesh'; $lastName = 'test'; $email = 'maheshtrialnew@gmail.com'; $organisation = htmlspecialchars('mytrialorg'); $phone = htmlspecialchars('0405550505'); $username = $organisation; $username = mb_strtolower($username); $username = preg_replace('/[^a-zA-Z]+/', '', $username); $extraNumber = 1; while (User::findByUsernameOrAlias($username)) { $extraNumber++; preg_match('~^[^-]+~', $username, $matches); $username = $matches[0].'-'.$extraNumber; } $length = 9; $str = ''; $characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9')); $max = count($characters) - 1; for ($i = 0; $i < $length; $i++) { $rand = mt_rand(0, $max); $str .= $characters[$rand]; } $password = 'Mahesh123#'; $expiryDate = Carbon::today()->addDays(31)->format('Y-m-d'); $userDetails = [ 'username' => $username, 'email' => $email, 'password' => Hash::make($password), 'phone' => $phone, 'name' => $firstName . ' ' . $lastName, 'organisation' => $organisation, 'plan' => 'trial', 'status' => 'active', 'uuid' => (string) Str::uuid(), 'expiry' => $expiryDate, ]; $user = User::create($userDetails); $user->createOwnOrganisation(); event(new Registered($user)); $trialFormStatus = new UserTrialFormstatus; $trialFormStatus->user_id = $user->id; $trialFormStatus->formstatus = 'good'; $trialFormStatus->save(); $trialDevice = new UserTrialDevice; $trialDevice->user_id = $user->id; $trialDevice->device = '127.7.7.1'; $trialDevice->save(); dd($user);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter