Berater Register, Mitgliedschat live

https://dev.adametz.media:3000/cliquers/mivita.care/issues/3
This commit is contained in:
Kevin Adametz 2020-03-09 14:45:09 +01:00
parent 21abafb8db
commit 1ada368ed4
43 changed files with 286 additions and 114 deletions

View file

@ -7,6 +7,7 @@ use App\Models\File;
use App\Models\Product;
use App\Models\ShoppingInstance;
use App\Models\UserAccount;
use App\Models\UserHistory;
use App\Repositories\FileRepository;
use App\Services\Util;
use App\User;
@ -51,12 +52,16 @@ class WizardController extends Controller
$step = !$user->wizard ? 0 : $user->wizard;
if($step >= 20){
return redirect('/');
return redirect('/home');
}
$userHistoryWizardPayment = UserHistory::whereUserId($user->id)->whereAction('wizard_payment')->get()->last();
$data = [
'user' => Auth::user(),
'step' => $step,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'userHistoryWizardPayment' => $userHistoryWizardPayment,
];
if($step == 15){
@ -83,7 +88,7 @@ class WizardController extends Controller
$step = !$user->wizard ? 0 : $user->wizard;
if($step >= 10){
return redirect('/');
return redirect('/home');
}
$data = [
'user' => Auth::user(),
@ -111,10 +116,14 @@ class WizardController extends Controller
return redirect(route('wizard_payment'));
}
$userHistoryWizardPayment = UserHistory::whereUserId($user->id)->whereAction('wizard_payment')->get()->last();
$data = [
'user' => Auth::user(),
'step' => 0,
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
'userHistoryWizardPayment' => $userHistoryWizardPayment,
];
if($user->wizard == 20){
@ -137,7 +146,6 @@ class WizardController extends Controller
}
if ($step == 0) {
$rules = array(
'accepted_data_protection' => 'required',
'accepted_active' => 'required',
@ -244,11 +252,16 @@ class WizardController extends Controller
}
if ($step == 4) {
$user->wizard = 5;
$user->release_account = now();
$user->save();
Mail::to('kevin@adametz.media')->bcc(['kevin.adametz@me.com'])->send(new MailReleaseAccount($user));
if($user->isTestMode()){
$mail = config('app.info_test_mail');
}else{
$mail = config('app.info_mail');
}
Mail::to($mail)->send(new MailReleaseAccount($user));
return redirect(route('wizard_register'));
}
@ -371,13 +384,16 @@ class WizardController extends Controller
}
}
public function storePayment($step = 0){
if(Input::get('switchers-package-wizard')){
$user = Auth::user();
$user = User::find(Auth::user()->id);
Yard::instance('shopping')->destroy();
$product = Product::find(Input::get('switchers-package-wizard'));
$showAboOptions = false;
if(Input::get('abo_options')){
$showAboOptions = true;
$user->abo_options = true;
$user->save();
}
@ -396,7 +412,7 @@ class WizardController extends Controller
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for buy intern
'auth_user_id' => Auth::user()->id,
'payment' => 4,
'payment' => 4, //Berater Wizard
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
@ -404,6 +420,7 @@ class WizardController extends Controller
Yard::instance('shopping')->store($identifier);
//add to DB
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
UserHistory::create(['user_id' => $user->id, 'action'=>'wizard_payment', 'status'=>1, 'product_id'=>$product->id, 'identifier'=>$identifier, 'abo_options'=>$showAboOptions]);
//$path = str_replace('http', 'https', $path);
return redirect()->secure($path);