updated checkout flow
This commit is contained in:
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use App\Traits\CaptchaTrait;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\user\UserModel;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -72,6 +73,7 @@ class CustomAuthController extends Controller
|
||||
public function postRegister(Request $request)
|
||||
{
|
||||
$post = $request->all();
|
||||
$userModel = new UserModel;
|
||||
|
||||
$post['captcha'] = $this->captchaCheck();
|
||||
|
||||
@@ -87,6 +89,12 @@ class CustomAuthController extends Controller
|
||||
'g-recaptcha-response.required' => 'Captcha is required',
|
||||
'captcha.min' => 'Wrong captcha, please try again.'
|
||||
]
|
||||
|
||||
// $post,
|
||||
// [
|
||||
// 'username' => 'unique:user_logins',
|
||||
// 'email' => 'unique:user_logins',
|
||||
// ]
|
||||
);
|
||||
|
||||
|
||||
@@ -105,9 +113,9 @@ class CustomAuthController extends Controller
|
||||
$message = '
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<strong>Error!</strong>' . $errors .
|
||||
'<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
'<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>';
|
||||
|
||||
|
||||
|
||||
return response()->json(array(
|
||||
'success' => false,
|
||||
@@ -115,7 +123,7 @@ class CustomAuthController extends Controller
|
||||
));
|
||||
}
|
||||
|
||||
User::create([
|
||||
$user = User::create([
|
||||
'name' => $post['name'],
|
||||
'username' => $post['username'],
|
||||
'email' => $post['email'],
|
||||
@@ -123,10 +131,19 @@ class CustomAuthController extends Controller
|
||||
'role' => 'user'
|
||||
]);
|
||||
|
||||
$country = explode("_", $post['country']);
|
||||
|
||||
$data = array(
|
||||
'UserId' => $user->id,
|
||||
'CountryCode' => $country[0],
|
||||
'Country' => $country[1]
|
||||
);
|
||||
$userModel->insertAddressBook($data);
|
||||
Auth::attempt(['email' => $post['email'], 'password' => $post['password']]);
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true
|
||||
'success' => true,
|
||||
'redirect' => $post['redirect']
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user