647 lines
No EOL
25 KiB
PHP
Executable file
647 lines
No EOL
25 KiB
PHP
Executable file
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Auth;
|
|
use Hash;
|
|
use Yard;
|
|
use Request;
|
|
use App\User;
|
|
use Validator;
|
|
use App\Models\File;
|
|
use App\Services\Util;
|
|
use App\Models\Product;
|
|
use App\Models\UserAccount;
|
|
use App\Models\UserHistory;
|
|
use App\Services\UserService;
|
|
use App\Mail\MailAccountActive;
|
|
use App\Models\ShippingCountry;
|
|
use App\Mail\MailReleaseAccount;
|
|
use App\Models\ShoppingInstance;
|
|
use App\Mail\MailAutoReleaseAccount;
|
|
use App\Repositories\FileRepository;
|
|
use App\Repositories\UserRepository;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use App\Repositories\ContractPDFRepository;
|
|
|
|
class WizardController extends Controller
|
|
{
|
|
|
|
protected $fileRepo;
|
|
|
|
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(FileRepository $fileRepo)
|
|
{
|
|
$this->fileRepo = $fileRepo;
|
|
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
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_create'));
|
|
}
|
|
|
|
$step = !$user->wizard ? 0 : $user->wizard;
|
|
|
|
if($step >= 20){
|
|
return redirect('/home');
|
|
}
|
|
$userHistoryWizardPayment = UserHistory::whereUserId($user->id)->whereAction('wizard_payment')->get()->last();
|
|
|
|
$data = [
|
|
'user' => Auth::user(),
|
|
'step' => $step,
|
|
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
|
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
|
'userHistoryWizardPayment' => $userHistoryWizardPayment,
|
|
];
|
|
|
|
if($step == 15){
|
|
return view('user.wizard.create_release', $data);
|
|
}
|
|
|
|
return view('user.wizard.create', $data);
|
|
}
|
|
|
|
public function register()
|
|
{
|
|
|
|
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_register'));
|
|
}
|
|
|
|
$step = !$user->wizard ? 0 : $user->wizard;
|
|
|
|
if($step >= 10){
|
|
return redirect('/home');
|
|
}
|
|
|
|
$data = [
|
|
'user' => Auth::user(),
|
|
'step' => $step,
|
|
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
|
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
|
];
|
|
if($step == 5){
|
|
if($user->active){
|
|
$user->active = false;
|
|
$user->save();
|
|
}
|
|
return view('user.wizard.register_release', $data);
|
|
}
|
|
|
|
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'));
|
|
}
|
|
|
|
$userHistoryWizardPayment = UserHistory::whereUserId($user->id)->whereAction('wizard_payment')->get()->last();
|
|
|
|
$shipping_country_id = $this->checkShoppingCountry($user);
|
|
if(!$shipping_country_id){
|
|
abort(403, __('validation.custom.shipping_not_found'));
|
|
}
|
|
|
|
UserService::checkUserTaxShippingCountry($user, $shipping_country_id);
|
|
//Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for);
|
|
//Yard::instance('shopping')->setUserPriceInfos(UserService::getYardInfo());
|
|
|
|
$data = [
|
|
'user' => Auth::user(),
|
|
'step' => 0,
|
|
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
|
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
|
'userHistoryWizardPayment' => $userHistoryWizardPayment,
|
|
'yard_info' => UserService::getYardInfo(),
|
|
];
|
|
|
|
|
|
if($user->wizard == 20){
|
|
return view('user.wizard.register_payment', $data);
|
|
}
|
|
|
|
return redirect(route('/'));
|
|
}
|
|
|
|
private function checkShoppingCountry($user ){
|
|
|
|
$country_id = null;
|
|
if($user->account->same_as_billing){
|
|
$country_id = $user->account->country_id;
|
|
}else{
|
|
$country_id = $user->account->shipping_country_id;
|
|
}
|
|
if($country_id){
|
|
if($shipping_country = ShippingCountry::whereCountryId($country_id)->first()){
|
|
return $shipping_country->id;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function storeRegister($step = false)
|
|
{
|
|
|
|
if (!Auth::check()) {
|
|
return redirect('login');
|
|
}
|
|
$user = User::findOrFail(Auth::user()->id);
|
|
if (!$user->account) {
|
|
$user->account = new UserAccount();
|
|
}
|
|
|
|
|
|
$data = Request::all();
|
|
if($step == 7 && Request::get('user_country_id')){
|
|
$user->account->country_id = Request::get('user_country_id');
|
|
$user->account->save();
|
|
return redirect(route('wizard_register', [1]));
|
|
}
|
|
if ($step == 0) {
|
|
$rules = array(
|
|
'accepted_data_protection' => 'required',
|
|
'accepted_active' => 'required',
|
|
'accepted_contract' => 'required'
|
|
);
|
|
$validator = Validator::make(Request::all(), $rules);
|
|
if ($validator->fails()) {
|
|
$data = [
|
|
'user' => Auth::user(),
|
|
'step' => $step,
|
|
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
|
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
|
];
|
|
$user->wizard = 0;
|
|
$user->save();
|
|
return view('user.wizard.register', $data)->withErrors($validator);
|
|
}
|
|
$account = $user->account;
|
|
if($account->accepted_contract === null){
|
|
$account->accepted_contract = now();
|
|
}
|
|
if($account->data_protection === null){
|
|
$account->data_protection = now();
|
|
}
|
|
$account->save();
|
|
if($user->agreement === null){
|
|
$user->agreement = now();
|
|
}
|
|
|
|
$user->wizard = 1;
|
|
$user->save();
|
|
return redirect(route('wizard_register'));
|
|
}
|
|
if ($step == 1) {
|
|
|
|
$data = Request::all();
|
|
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
|
$user->wizard = 1;
|
|
$user->save();
|
|
$userRepo = new UserRepository($user);
|
|
return $userRepo->reverse_charge_validate($data, $user, route('wizard_register', [0]));
|
|
}
|
|
|
|
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
|
$user->wizard = 1;
|
|
$user->save();
|
|
$userRepo = new UserRepository($user);
|
|
return $userRepo->reverse_charge_delete($data, $user, route('wizard_register', [0]));
|
|
}
|
|
|
|
$rules = array(
|
|
'salutation' => '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 (!Request::get('same_as_billing')) {
|
|
$rules = array_merge($rules, [
|
|
'shipping_firstname' => 'required',
|
|
'shipping_lastname' => 'required',
|
|
'shipping_address' => 'required',
|
|
'shipping_zipcode' => 'required',
|
|
'shipping_city' => 'required',
|
|
'shipping_salutation' => 'required',
|
|
'shipping_country_id' => 'required|integer|min:1',
|
|
]);
|
|
}
|
|
$validator = Validator::make(Request::all(), $rules);
|
|
if ($validator->fails()) {
|
|
$user->wizard = 1;
|
|
$user->save();
|
|
return redirect(route('wizard_register', [1]))->withErrors($validator)->withInput(Request::all());
|
|
}
|
|
$data['same_as_billing'] = Request::get('same_as_billing') == NULL ? 0 : 1;
|
|
$user->account->fill($data)->save();
|
|
$user->wizard = 2;
|
|
$user->save();
|
|
return redirect(route('wizard_register'));
|
|
}
|
|
|
|
if ($step == 2) {
|
|
if(Request::get('submit') === 'do'){
|
|
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
|
$validator = Validator::make(Request::all(), []);
|
|
$validator->errors()->add('field', __('msg.no_id_card_deposited_please_upload_first'));
|
|
$user->wizard = 2;
|
|
$user->save();
|
|
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
|
}
|
|
$user->wizard = 3;
|
|
$user->save();
|
|
return redirect(route('wizard_register'));
|
|
}
|
|
$this->fileRepo->_set('disk', 'user');
|
|
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
|
$this->fileRepo->_set('user_id', $user->id);
|
|
$this->fileRepo->_set('identifier', 'id_card');
|
|
return $this->fileRepo->uploadFile(Request::all());
|
|
}
|
|
|
|
if ($step == 3) {
|
|
if(Request::get('submit') === 'do'){
|
|
$data = Request::all();
|
|
|
|
if($data['business_license_choose'] === "now"){
|
|
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
|
|
$validator = Validator::make(Request::all(), []);
|
|
$validator->errors()->add('field', __('msg.no_trade_licence_deposited_please_upload_first'));
|
|
$user->wizard = 3;
|
|
$user->save();
|
|
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
|
}
|
|
}
|
|
if($data['business_license_choose'] === "later"){
|
|
|
|
}
|
|
if($data['business_license_choose'] === "non"){
|
|
if(!$data['non_business_license_reason'] || $data['non_business_license_reason'] == ""){
|
|
$validator = Validator::make(Request::all(), []);
|
|
$validator->errors()->add('field', __('msg.please_enter_reason_why_you_not_need_trade_licence'));
|
|
$user->wizard = 3;
|
|
$user->save();
|
|
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
|
}else{
|
|
$user->account->setNotice('business_license_reason', $data['non_business_license_reason']);
|
|
}
|
|
}
|
|
|
|
$user->account->setNotice('business_license', $data['business_license_choose']);
|
|
$user->wizard = 4;
|
|
$user->save();
|
|
|
|
return redirect(route('wizard_register'));
|
|
}
|
|
$this->fileRepo->_set('disk', 'user');
|
|
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
|
$this->fileRepo->_set('user_id', $user->id);
|
|
$this->fileRepo->_set('identifier', 'business_license');
|
|
return $this->fileRepo->uploadFile(Request::all());
|
|
}
|
|
|
|
if ($step == 4) {
|
|
|
|
return $this->releaseAccount($user);
|
|
/*
|
|
$user->wizard = 5; // muss freigeschaltet werden
|
|
$user->release_account = now();
|
|
UserHistory::create(['user_id' => $user->id, 'action'=>'release_account', 'status'=>0]);
|
|
$user->save();
|
|
|
|
if($user->isTestMode()){
|
|
$mail = config('app.info_test_mail');
|
|
}else{
|
|
$mail = config('app.info_mail');
|
|
}
|
|
//Mail zur Freischaltung
|
|
Mail::to($mail)->locale($user->getLocale())->send(new MailReleaseAccount($user));
|
|
|
|
//return redirect(route('wizard_register'));
|
|
*/
|
|
}
|
|
}
|
|
|
|
//auto release account
|
|
public function releaseAccount($user)
|
|
{
|
|
|
|
$user->m_sponsor = $user->m_sponsor ? $user->m_sponsor : 1;
|
|
$user->account->m_first_name = $user->account->m_first_name ? $user->account->m_first_name : $user->account->first_name;
|
|
$user->account->m_last_name = $user->account->m_last_name ? $user->account->m_last_name : $user->account->last_name;
|
|
$user->account->m_account = UserAccount::withTrashed()->max('m_account') +1;
|
|
$user->account->save();
|
|
$user->save();
|
|
//create PDF
|
|
$pdf = new ContractPDFRepository($user);
|
|
$pdf->_set('disk', 'user');
|
|
$pdf->_set('dir', '/'.$user->id.'/documents/');
|
|
$pdf->_set('user_id', $user->id);
|
|
$pdf->_set('identifier', 'contract');
|
|
$pdf->createContractPDF();
|
|
|
|
//set wizard tp payments
|
|
$user->wizard = 20;
|
|
$user->active = 1;
|
|
$user->active_date = now();
|
|
$user->release_account = now();
|
|
$user->confirmation_code = null;
|
|
$user->confirmation_code_to = null;
|
|
$user->confirmation_code_remider = 0;
|
|
$user->save();
|
|
|
|
//mail with code to user?
|
|
if($user->isTestMode()){
|
|
$mail = config('app.info_test_mail');
|
|
}else{
|
|
$mail = config('app.info_mail');
|
|
}
|
|
Mail::to($mail)->locale($user->getLocale())->send(new MailAutoReleaseAccount($user));
|
|
UserHistory::create(['user_id' => $user->id, 'action'=>'release_account', 'status'=>0]);
|
|
Mail::to($user->email)->locale($user->getLocale())->send(new MailAccountActive($user));
|
|
UserHistory::create(['user_id' => $user->id, 'action'=>'released_completed', 'status'=>0]);
|
|
\Session()->flash('alert-success', __('msg.account_released'));
|
|
return redirect(route('wizard_payment'));
|
|
}
|
|
|
|
public function storeCreate($step = 0)
|
|
{
|
|
|
|
if(!Auth::check()){
|
|
return redirect('login');
|
|
}
|
|
|
|
$user = User::findOrFail(Auth::user()->id);
|
|
if(!$user->account){
|
|
$user->account = new UserAccount();
|
|
}
|
|
|
|
if($step == 10){
|
|
$rules = array(
|
|
'accepted_data_protection' => 'required',
|
|
'accepted_active' => 'required',
|
|
);
|
|
$validator = Validator::make(Request::all(), $rules);
|
|
if ($validator->fails()) {
|
|
$data = [
|
|
'user' => Auth::user(),
|
|
'step' => $step,
|
|
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
|
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
|
];
|
|
$user->wizard = 10;
|
|
$user->save();
|
|
return view('user.wizard.create', $data)->withErrors($validator);
|
|
|
|
}
|
|
$account = $user->account;
|
|
if($account->accepted_contract === null){
|
|
$account->accepted_contract = now();
|
|
}
|
|
if($account->data_protection === null){
|
|
$account->data_protection = now();
|
|
}
|
|
$account->save();
|
|
if($user->agreement === null){
|
|
$user->agreement = now();
|
|
}
|
|
$user->wizard = 11;
|
|
$user->save();
|
|
|
|
return redirect(route('wizard_create', [11]));
|
|
}
|
|
if($step == 11){
|
|
|
|
if($user->isPasswort()){
|
|
$user->wizard = 12;
|
|
$user->save();
|
|
return redirect(route('wizard_create', [12]));
|
|
}
|
|
$rules = array(
|
|
'password' => 'required|string|min:6|confirmed',
|
|
);
|
|
$validator = Validator::make(Request::all(), $rules);
|
|
if ($validator->fails()) {
|
|
$data = [
|
|
'user' => Auth::user(),
|
|
'step' => $step,
|
|
'products' => Product::where('active', true)->whereJsonContains('show_on', ['7', '8'])->orderBy('pos', 'ASC')->get(),
|
|
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '9')->orderBy('pos', 'ASC')->get(),
|
|
];
|
|
return view('user.wizard.create', $data)->withErrors($validator);
|
|
}
|
|
|
|
$user->fill([
|
|
'password' => Hash::make(Request::get('password'))
|
|
])->save();
|
|
$user->wizard = 12;
|
|
|
|
$user->save();
|
|
return redirect(route('wizard_create', [12]));
|
|
}
|
|
if($step == 12){
|
|
|
|
$data = Request::all();
|
|
|
|
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
|
$user->wizard = 12;
|
|
$user->save();
|
|
$userRepo = new UserRepository($user);
|
|
return $userRepo->reverse_charge_validate($data, $user, route('wizard_create', [12]));
|
|
}
|
|
|
|
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
|
$user->wizard = 12;
|
|
$user->save();
|
|
$userRepo = new UserRepository($user);
|
|
return $userRepo->reverse_charge_delete($data, $user, route('wizard_create', [12]));
|
|
}
|
|
|
|
|
|
$rules = array(
|
|
'salutation' => '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(!Request::get('same_as_billing')){
|
|
$rules = array_merge($rules, [
|
|
'shipping_firstname'=>'required',
|
|
'shipping_lastname'=>'required',
|
|
'shipping_address'=>'required',
|
|
'shipping_zipcode'=>'required',
|
|
'shipping_city' => 'required',
|
|
'shipping_salutation' => 'required'
|
|
|
|
]);
|
|
}
|
|
$validator = Validator::make(Request::all(), $rules);
|
|
if ($validator->fails()) {
|
|
return redirect(route('wizard_create', [12]))->withErrors($validator)->withInput(Request::all());
|
|
}
|
|
|
|
$data = Request::all();
|
|
$data['same_as_billing'] = Request::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]));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public function storePayment($step = 0){
|
|
|
|
if(Request::get('switchers-package-wizard')){
|
|
$user = User::find(Auth::user()->id);
|
|
Yard::instance('shopping')->destroy();
|
|
$product = Product::find(Request::get('switchers-package-wizard'));
|
|
$showAboOptions = false;
|
|
if(Request::get('abo_options')){
|
|
$showAboOptions = false; //true Abo Option deaktivert
|
|
$user->abo_options = false; //true Abo Option deaktivert
|
|
$user->save();
|
|
}
|
|
|
|
$shipping_country_id = $this->checkShoppingCountry($user);
|
|
if(!$shipping_country_id){
|
|
abort(403, __('validation.custom.shipping_not_found'));
|
|
}
|
|
|
|
UserService::checkUserTaxShippingCountry($user, $shipping_country_id);
|
|
Yard::instance('shopping')->setUserPriceInfos(UserService::getYardInfo());
|
|
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id);
|
|
|
|
|
|
if($product && $product->active){
|
|
//set membership product
|
|
$image = "";
|
|
if($product->images->count()){
|
|
$image = $product->images->first()->slug;
|
|
}
|
|
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
|
if(\App\Services\UserService::getTaxFree()){
|
|
Yard::setTax($cartItem->rowId, 0);
|
|
}else{
|
|
Yard::setTax($cartItem->rowId, $product->getTaxWith(\App\Services\UserService::$user_country));
|
|
}
|
|
|
|
//set onboarding products
|
|
if(Request::get('products_on_board')){
|
|
foreach (Request::get('products_on_board') as $product_on_board_id){
|
|
$product_on_board = Product::find($product_on_board_id);
|
|
$image = "";
|
|
if($product_on_board->images->count()){
|
|
$image = $product_on_board->images->first()->slug;
|
|
}
|
|
$cartItem = Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight, 'points' => $product_on_board->points, 'no_commission' => $product_on_board->no_commission]);
|
|
if(\App\Services\UserService::getTaxFree()){
|
|
Yard::setTax($cartItem->rowId, 0);
|
|
}else{
|
|
Yard::setTax($cartItem->rowId, $product->getTaxWith(\App\Services\UserService::$user_country));
|
|
}
|
|
}
|
|
}
|
|
|
|
do {
|
|
$identifier = Util::getToken();
|
|
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
|
|
|
$data = [];
|
|
$data['is_from'] = 'wizard';
|
|
$data['is_for'] = 'me';
|
|
$data['user_price_infos'] = \App\Services\UserService::getUserPriceInfos();
|
|
|
|
ShoppingInstance::create([
|
|
'identifier' => $identifier,
|
|
'user_shop_id' => 1, //is first faker shop for buy intern
|
|
'auth_user_id' => Auth::user()->id,
|
|
'payment' => 4, //Berater Wizard
|
|
'subdomain' => url('/'),
|
|
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
|
'language' => \App::getLocale(),
|
|
'shopping_data' => $data,
|
|
'back' => url()->previous(),
|
|
|
|
]);
|
|
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);
|
|
|
|
}
|
|
}
|
|
\Session()->flash('alert-error', "Fehler beim Produkt");
|
|
return back();
|
|
}
|
|
|
|
public function delete($id, $relation){
|
|
|
|
if($relation === 'upload'){
|
|
$user = User::findOrFail(Auth::user()->id);
|
|
$file = $user->files()->findOrFail($id);
|
|
//remove file
|
|
\Storage::disk('user')->delete($file->dir.$file->filename);
|
|
$file->delete();
|
|
\Session()->flash('alert-success', __('msg.file_deleted'));
|
|
}
|
|
return back();
|
|
}
|
|
|
|
|
|
} |