membership register
This commit is contained in:
parent
3711fcc8d0
commit
37cb2b06c7
38 changed files with 1261 additions and 463 deletions
|
|
@ -36,7 +36,6 @@ class WizardController extends Controller
|
|||
|
||||
public function create()
|
||||
{
|
||||
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
|
|
@ -46,11 +45,12 @@ class WizardController extends Controller
|
|||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
$user->save();
|
||||
return redirect(route('wizard'));
|
||||
return redirect(route('wizard_create'));
|
||||
}
|
||||
|
||||
$step = !$user->wizard ? 0 : $user->wizard;
|
||||
if($step == 10){
|
||||
|
||||
if($step >= 20){
|
||||
return redirect('/');
|
||||
}
|
||||
$data = [
|
||||
|
|
@ -59,6 +59,10 @@ class WizardController extends Controller
|
|||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
|
||||
if($step == 15){
|
||||
return view('user.wizard.create_release', $data);
|
||||
}
|
||||
|
||||
return view('user.wizard.create', $data);
|
||||
}
|
||||
|
||||
|
|
@ -73,12 +77,12 @@ class WizardController extends Controller
|
|||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
$user->save();
|
||||
return redirect(route('wizard'));
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
|
||||
$step = !$user->wizard ? 0 : $user->wizard;
|
||||
|
||||
if($step == 10){
|
||||
if($step >= 10){
|
||||
return redirect('/');
|
||||
}
|
||||
$data = [
|
||||
|
|
@ -93,6 +97,33 @@ class WizardController extends Controller
|
|||
return view('user.wizard.register', $data);
|
||||
}
|
||||
|
||||
public function payment()
|
||||
{
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
$user->save();
|
||||
return redirect(route('wizard_payment'));
|
||||
}
|
||||
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => 0,
|
||||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
|
||||
if($user->wizard == 20){
|
||||
return view('user.wizard.register_payment', $data);
|
||||
}
|
||||
|
||||
return redirect(route('/'));
|
||||
}
|
||||
|
||||
public function storeRegister($step = false)
|
||||
{
|
||||
|
||||
|
|
@ -235,7 +266,7 @@ class WizardController extends Controller
|
|||
$user->account = new UserAccount();
|
||||
}
|
||||
|
||||
if($step == 0){
|
||||
if($step == 10){
|
||||
$rules = array(
|
||||
'accepted_data_protection' => 'required',
|
||||
'accepted_active' => 'required',
|
||||
|
|
@ -245,33 +276,33 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
return view('user.wizard.show', $data)->withErrors($validator);
|
||||
$user->wizard = 10;
|
||||
$user->save();
|
||||
return view('user.wizard.create', $data)->withErrors($validator);
|
||||
|
||||
}
|
||||
$account = $user->account;
|
||||
$account->data_protection = now();
|
||||
if($account->data_protection === null){
|
||||
$account->data_protection = now();
|
||||
}
|
||||
if($user->agreement === null){
|
||||
$user->agreement = now();
|
||||
}
|
||||
$account->save();
|
||||
$user->agreement = now();
|
||||
if($user->wizard < 1){
|
||||
$user->wizard = 1;
|
||||
}
|
||||
$user->wizard = 11;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard', [1]));
|
||||
return redirect(route('wizard_create', [11]));
|
||||
}
|
||||
if($step == 1){
|
||||
if($step == 11){
|
||||
|
||||
if($user->isPasswort()){
|
||||
if($user->wizard < 2){
|
||||
$user->wizard = 2;
|
||||
}
|
||||
//has Passwort -> delete Code!
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->wizard = 12;
|
||||
$user->save();
|
||||
return redirect(route('wizard', [2]));
|
||||
return redirect(route('wizard_create', [12]));
|
||||
}
|
||||
$rules = array(
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
|
|
@ -281,34 +312,31 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->where('show_at', '=', 3)->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
return view('user.wizard.show', $data)->withErrors($validator);
|
||||
}else{
|
||||
$user->fill([
|
||||
'password' => Hash::make(Input::get('password'))
|
||||
])->save();
|
||||
if($user->wizard < 2){
|
||||
$user->wizard = 2;
|
||||
}
|
||||
//has Passwort -> delete Code!
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
return redirect(route('wizard', [2]));
|
||||
|
||||
|
||||
|
||||
return view('user.wizard.create', $data)->withErrors($validator);
|
||||
}
|
||||
|
||||
$user->fill([
|
||||
'password' => Hash::make(Input::get('password'))
|
||||
])->save();
|
||||
$user->wizard = 12;
|
||||
|
||||
$user->save();
|
||||
return redirect(route('wizard_create', [12]));
|
||||
}
|
||||
if($step == 2){
|
||||
if($step == 12){
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name'=>'required',
|
||||
'last_name'=>'required',
|
||||
'address'=>'required',
|
||||
'zipcode'=>'required',
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'address' => 'required',
|
||||
'zipcode' => 'required',
|
||||
'city' => 'required',
|
||||
'phone' => 'required_without:mobil',
|
||||
'mobil' => 'required_without:phone',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'birthday' => 'required',
|
||||
);
|
||||
|
||||
if(!Input::get('same_as_billing')){
|
||||
|
|
@ -324,63 +352,65 @@ class WizardController extends Controller
|
|||
}
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return redirect(route('wizard', [2]))->withErrors($validator)->withInput(Input::all());
|
||||
}else{
|
||||
$data = Input::all();
|
||||
$data['same_as_billing'] = Input::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$user->account->fill($data)->save();
|
||||
if($user->wizard < 3){
|
||||
$user->wizard = 3;
|
||||
}
|
||||
$user->active_date = now();
|
||||
$user->active = 1;
|
||||
$user->save();
|
||||
return redirect(route('wizard', [3]));
|
||||
|
||||
return redirect(route('wizard_create', [12]))->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
}
|
||||
|
||||
if($step == 3){
|
||||
$data = Input::all();
|
||||
$data['same_as_billing'] = Input::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$user->account->fill($data)->save();
|
||||
|
||||
$user->wizard = 13;
|
||||
$user->active_date = now();
|
||||
$user->active = 1;
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
return redirect(route('wizard_create', [13]));
|
||||
|
||||
if(Input::get('switchers-package-wizard')){
|
||||
Yard::instance('shopping')->destroy();
|
||||
$product = Product::find(Input::get('switchers-package-wizard'));
|
||||
if($product && $product->active && $product->show_at == 3){
|
||||
$image = "";
|
||||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop!
|
||||
'auth_user_id' => $user->id,
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
|
||||
]);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
\Session()->flash('alert-error', "Fehler beim Produkt");
|
||||
return redirect(route('wizard', [3]));
|
||||
}
|
||||
}
|
||||
|
||||
public function storePayment($step = 0){
|
||||
if(Input::get('switchers-package-wizard')){
|
||||
$user = Auth::user();
|
||||
Yard::instance('shopping')->destroy();
|
||||
$product = Product::find(Input::get('switchers-package-wizard'));
|
||||
|
||||
if(Input::get('abo_options')){
|
||||
$user->abo_options = true;
|
||||
$user->save();
|
||||
}
|
||||
if($product && $product->active && $product->show_at == 3){
|
||||
$image = "";
|
||||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop!
|
||||
'auth_user_id' => Auth::user()->id,
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
|
||||
]);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
|
||||
}
|
||||
}
|
||||
\Session()->flash('alert-error', "Fehler beim Produkt");
|
||||
return back();
|
||||
}
|
||||
|
||||
public function delete($id, $relation){
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue