Partnercenter: Rollen-Flags fuer Einzelprovision und interne Rollen
- exclude_single_commission: Rollen (z. B. Barkunde 0 %) ziehen den produktseitigen Kunden-Einzelrabatt (single_commission/value_commission) nicht mehr ab. Behebt: 0-%-Rolle zog trotzdem die Produktprovision. - hide_registration: interne Rollen (z. B. Mitarbeiter) werden im Wizard und der Mitgliedschafts-Auswahl ausgeblendet, bleiben im Admin/Lead (HTMLHelper) weiter zuweisbar. - Migration 2026_09_11_100000 (beide Flags, Default false), Model-casts/ fillable, Admin-Formular (2 Checkboxen), Warenkorb-Gate in Yard. - Test tests/Feature/UserLevelSingleCommissionTest.php. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ef19dc2ced
commit
5e55fa63bb
8 changed files with 752 additions and 521 deletions
|
|
@ -10,13 +10,10 @@ use App\Models\UserLevel;
|
|||
use App\User;
|
||||
use Auth;
|
||||
use Carbon;
|
||||
use Config;
|
||||
use Illuminate\Validation\Rules\In;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Request;
|
||||
use Util;
|
||||
use Yard;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
||||
class MembershipController extends Controller
|
||||
{
|
||||
|
|
@ -30,14 +27,13 @@ class MembershipController extends Controller
|
|||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$user = User::find(Auth::user()->id);
|
||||
$diff_months = 0;
|
||||
|
||||
if($user->payment_account){
|
||||
$diff_months = Carbon::now()->diffInMonths(Carbon::parse($user->payment_account)) +1;
|
||||
if ($user->payment_account) {
|
||||
$diff_months = Carbon::now()->diffInMonths(Carbon::parse($user->payment_account)) + 1;
|
||||
}
|
||||
|
||||
$userHistoryPaymentOrder = UserHistory::whereUserId($user->id)->whereAction('payment_order')->get()->last();
|
||||
|
|
@ -45,27 +41,26 @@ class MembershipController extends Controller
|
|||
$userHistoryDeleteMembership = UserHistory::whereUserId($user->id)->whereAction('delete_membership')->whereStatus(50)->get()->last();
|
||||
$data = [
|
||||
'user' => $user,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'upgrade' => Product::where('active', true)->whereJsonContains('show_on', '5')->where('identifier', 'upgrade')->get(),
|
||||
'diff_months' => $diff_months,
|
||||
'userHistoryPaymentOrder' => $userHistoryPaymentOrder,
|
||||
'userHistoryUpgradeOrder' => $userHistoryUpgradeOrder,
|
||||
'userHistoryDeleteMembership' => $userHistoryDeleteMembership,
|
||||
'user_levels' => UserLevel::where('active', true)->orderBy('pos')->get(),
|
||||
'user_levels' => UserLevel::where('active', true)->where('hide_registration', false)->orderBy('pos')->get(),
|
||||
|
||||
];
|
||||
|
||||
return view('user.membership.index', $data);
|
||||
|
||||
}
|
||||
|
||||
public function storePayment($action){
|
||||
|
||||
public function storePayment($action)
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
|
||||
|
||||
//#### remove_abo
|
||||
// #### remove_abo
|
||||
/*if($action === "remove_abo"){
|
||||
if(Request::get('abo_options_remove')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
|
|
@ -80,28 +75,28 @@ class MembershipController extends Controller
|
|||
\Session()->flash('alert-error', "Fehler, Checkbox nicht bestätigt.");
|
||||
return back();
|
||||
}*/
|
||||
//#### payment order
|
||||
//#### shop upgrade
|
||||
if($action === "upgrade_order" || $action === "payment_order"){
|
||||
if(Request::get('switchers-package-wizard')){
|
||||
// #### payment order
|
||||
// #### shop upgrade
|
||||
if ($action === 'upgrade_order' || $action === 'payment_order') {
|
||||
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 = true;
|
||||
$user->abo_options = true;
|
||||
$user->save();
|
||||
}*/
|
||||
if($product && $product->active){
|
||||
$image = "";
|
||||
if($product->images->count()){
|
||||
// $showAboOptions = false;
|
||||
/* if(Request::get('abo_options')){
|
||||
$showAboOptions = true;
|
||||
$user->abo_options = true;
|
||||
$user->save();
|
||||
}*/
|
||||
if ($product && $product->active) {
|
||||
$image = '';
|
||||
if ($product->images->count()) {
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$qty = Request::get('qty') ? Request::get('qty') : 1;
|
||||
|
||||
/* //need setGlobalTaxRate
|
||||
|
||||
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $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);
|
||||
|
|
@ -109,7 +104,7 @@ class MembershipController extends Controller
|
|||
Yard::setTax($cartItem->rowId, $product->getTaxWith(\App\Services\UserService::$user_country));
|
||||
}
|
||||
*/
|
||||
//Keine steuer
|
||||
// Keine steuer
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->price, $product->tax, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
Yard::instance('shopping')->setGlobalTaxRate(0);
|
||||
/*
|
||||
|
|
@ -122,27 +117,27 @@ class MembershipController extends Controller
|
|||
$data['is_from'] = 'membership';
|
||||
$data['is_for'] = 'me';
|
||||
|
||||
/* ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for nuy intern
|
||||
'auth_user_id' => Auth::user()->id,
|
||||
'payment' => 3, //Vertriebspartner Membership
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
/* ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for nuy intern
|
||||
'auth_user_id' => Auth::user()->id,
|
||||
'payment' => 3, //Vertriebspartner Membership
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
]);*/
|
||||
]);*/
|
||||
Yard::instance('shopping')->putYardExtra('shopping_data', $data);
|
||||
|
||||
//Yard::instance('shopping')->store($identifier);
|
||||
//add to DB
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>$action, 'status'=>1, 'product_id'=>$product->id, 'identifier'=>$identifier]);
|
||||
// Yard::instance('shopping')->store($identifier);
|
||||
// add to DB
|
||||
UserHistory::create(['user_id' => $user->id, 'action' => $action, 'status' => 1, 'product_id' => $product->id, 'identifier' => $identifier]);
|
||||
|
||||
//$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
// return redirect()->secure($path);
|
||||
return redirect(route('user_checkout', [$identifier]));
|
||||
// $path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
// $path = str_replace('http', 'https', $path);
|
||||
// return redirect()->secure($path);
|
||||
return redirect(route('user_checkout', [$identifier]));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -169,39 +164,41 @@ class MembershipController extends Controller
|
|||
}
|
||||
*/
|
||||
|
||||
if($action === "change_level"){
|
||||
if(Request::get('switchers-package-level')){
|
||||
if ($action === 'change_level') {
|
||||
if (Request::get('switchers-package-level')) {
|
||||
$user = User::find(Auth::user()->id);
|
||||
//hier wird die nächste Mitgliedschaftsstufe gesetzt
|
||||
//wird im Cronjob UserCheckPaymentsAccounts.php verwendet und gesetzt
|
||||
// hier wird die nächste Mitgliedschaftsstufe gesetzt
|
||||
// wird im Cronjob UserCheckPaymentsAccounts.php verwendet und gesetzt
|
||||
$user->next_m_level = Request::get('switchers-package-level');
|
||||
$user->save();
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>$action, 'status'=>10, 'referenz'=>Request::get('switchers-package-level')]);
|
||||
\Session()->flash('alert-success', "Änderung gespeichert");
|
||||
UserHistory::create(['user_id' => $user->id, 'action' => $action, 'status' => 10, 'referenz' => Request::get('switchers-package-level')]);
|
||||
\Session()->flash('alert-success', 'Änderung gespeichert');
|
||||
|
||||
return back();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($action === "delete_membership"){
|
||||
if(Request::get('delete_membership')){
|
||||
//TODO
|
||||
if ($action === 'delete_membership') {
|
||||
if (Request::get('delete_membership')) {
|
||||
// TODO
|
||||
$user = User::find(Auth::user()->id);
|
||||
if($user->isTestMode()){
|
||||
if ($user->isTestMode()) {
|
||||
$mail = config('app.info_test_mail');
|
||||
}else{
|
||||
} else {
|
||||
$mail = config('app.info_mail');
|
||||
}
|
||||
Mail::to($mail)->send(new MailInfo($user, 'delete_membership'));
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>$action, 'status'=>50]);
|
||||
\Session()->flash('alert-success', "Mitgliedschaft beenden ist beantragt");
|
||||
UserHistory::create(['user_id' => $user->id, 'action' => $action, 'status' => 50]);
|
||||
\Session()->flash('alert-success', 'Mitgliedschaft beenden ist beantragt');
|
||||
|
||||
return back();
|
||||
}
|
||||
\Session()->flash('alert-error', "Fehler, Checkbox nicht bestätigt.");
|
||||
\Session()->flash('alert-error', 'Fehler, Checkbox nicht bestätigt.');
|
||||
|
||||
return back();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,15 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\Attribute;
|
||||
use App\Models\ProductAttribute;
|
||||
use App\Models\Shipping;
|
||||
use App\Models\UserLevel;
|
||||
use App\Models\UserLevelMargin;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
class UserLevelController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
|
@ -27,53 +23,59 @@ class UserLevelController extends Controller
|
|||
'values' => UserLevel::orderBy('pos')->get(),
|
||||
'trans' => array_keys(config('localization.supportedLocales')),
|
||||
];
|
||||
|
||||
return view('admin.level.index', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
if($id === "new"){
|
||||
$user_level = new UserLevel();
|
||||
if ($id === 'new') {
|
||||
$user_level = new UserLevel;
|
||||
$user_level->active = 1;
|
||||
|
||||
}else{
|
||||
} else {
|
||||
$user_level = UserLevel::findOrFail($id);
|
||||
|
||||
}
|
||||
$data = [
|
||||
'value' => $user_level,
|
||||
];
|
||||
|
||||
return view('admin.level.edit', $data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] === 'user_level') {
|
||||
if ($data['id'] === "new") {
|
||||
if ($data['action'] === 'user_level') {
|
||||
if ($data['id'] === 'new') {
|
||||
$user_level = UserLevel::create([
|
||||
'name' => $data['name'],
|
||||
'pos' => $data['pos'],
|
||||
'payment_year' => isset($data['payment_year']) ? true : false,
|
||||
'payment_year' => isset($data['payment_year']) ? true : false,
|
||||
'content' => $data['content'],
|
||||
'partner_provision' => isset($data['partner_provision']) ? true : false,
|
||||
'exclude_single_commission' => isset($data['exclude_single_commission']) ? true : false,
|
||||
'hide_registration' => isset($data['hide_registration']) ? true : false,
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
]);
|
||||
} else {
|
||||
$user_level = UserLevel::find($data['id']);
|
||||
$user_level->name = $data['name'];
|
||||
$user_level->pos = $data['pos'];
|
||||
$user_level->payment_year =isset($data['payment_year']) ? true : false;
|
||||
$user_level->payment_year = isset($data['payment_year']) ? true : false;
|
||||
$user_level->content = $data['content'];
|
||||
$user_level->partner_provision = isset($data['partner_provision']) ? true : false;
|
||||
$user_level->exclude_single_commission = isset($data['exclude_single_commission']) ? true : false;
|
||||
$user_level->hide_registration = isset($data['hide_registration']) ? true : false;
|
||||
$user_level->active = isset($data['active']) ? true : false;
|
||||
$user_level->save();
|
||||
}
|
||||
|
||||
if (!empty($data['trans'])) {
|
||||
if (! empty($data['trans'])) {
|
||||
$trans = [];
|
||||
foreach ($data['trans'] as $lang => $value) {
|
||||
if ($value && $value != null) {
|
||||
|
|
@ -87,19 +89,19 @@ class UserLevelController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if($data['action'] === 'user_level_margin') {
|
||||
if ($data['action'] === 'user_level_margin') {
|
||||
$user_level = UserLevel::findOrFail($data['user_level_id']);
|
||||
$rules = array('price_from' => 'required');
|
||||
$rules = ['price_from' => 'required'];
|
||||
$ret = ['value' => $user_level];
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return view('admin.level.edit', $ret)->withErrors($validator);
|
||||
}
|
||||
if ($data['id'] === "new") {
|
||||
if ($data['id'] === 'new') {
|
||||
$user_level_margin = UserLevelMargin::create($data);
|
||||
} else {
|
||||
$user_level_margin = UserLevelMargin::findOrFail($data['id']);
|
||||
if($user_level_margin->user_level_id != $user_level->id){
|
||||
if ($user_level_margin->user_level_id != $user_level->id) {
|
||||
abort(404);
|
||||
}
|
||||
$user_level_margin->fill($data);
|
||||
|
|
@ -108,23 +110,24 @@ class UserLevelController extends Controller
|
|||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
|
||||
return redirect(route('admin_level_edit', [$user_level->id]));
|
||||
|
||||
}
|
||||
|
||||
public function delete($do, $id)
|
||||
{
|
||||
if($do === 'user_level_margin'){
|
||||
if ($do === 'user_level_margin') {
|
||||
$model = UserLevelMargin::findOrFail($id);
|
||||
$id = $model->user_level->id;
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', "Eintrag gelöscht");
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
|
||||
return redirect(route('admin_level_edit', [$id]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*public function delete($id){
|
||||
|
||||
if(ProductAttribute::where('attribute_id', $id)->count()){
|
||||
|
|
@ -139,4 +142,4 @@ class UserLevelController extends Controller
|
|||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,30 +2,28 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Yard;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Mail\MailReleaseAccount;
|
||||
use App\Models\File;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Models\UserLevel;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Models\UserAccount;
|
||||
use App\Models\UserHistory;
|
||||
use App\Mail\MailReleaseAccount;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Models\UserLevel;
|
||||
use App\Repositories\FileRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Request;
|
||||
use Validator;
|
||||
use Yard;
|
||||
|
||||
class WizardController extends Controller
|
||||
{
|
||||
|
||||
protected $fileRepo;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
|
|
@ -39,21 +37,22 @@ class WizardController extends Controller
|
|||
|
||||
public function create()
|
||||
{
|
||||
if(!Auth::check()){
|
||||
if (! Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
if (! $user->account) {
|
||||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_create'));
|
||||
}
|
||||
|
||||
$step = !$user->wizard ? 0 : $user->wizard;
|
||||
$step = ! $user->wizard ? 0 : $user->wizard;
|
||||
|
||||
if($step >= 20){
|
||||
if ($step >= 20) {
|
||||
return redirect('/home');
|
||||
}
|
||||
$userHistoryWizardPayment = UserHistory::whereUserId($user->id)->whereAction('wizard_payment')->get()->last();
|
||||
|
|
@ -61,12 +60,12 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
'userHistoryWizardPayment' => $userHistoryWizardPayment,
|
||||
];
|
||||
|
||||
if($step == 15){
|
||||
if ($step == 15) {
|
||||
return view('user.wizard.create_release', $data);
|
||||
}
|
||||
|
||||
|
|
@ -76,32 +75,33 @@ class WizardController extends Controller
|
|||
public function register()
|
||||
{
|
||||
|
||||
if(!Auth::check()){
|
||||
if (! Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
if (! $user->account) {
|
||||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
|
||||
$step = !$user->wizard ? 0 : $user->wizard;
|
||||
$step = ! $user->wizard ? 0 : $user->wizard;
|
||||
|
||||
if($step >= 10){
|
||||
if ($step >= 10) {
|
||||
return redirect('/home');
|
||||
}
|
||||
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'user_levels' => UserLevel::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
//'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
//'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
|
||||
'user_levels' => UserLevel::where('active', true)->where('hide_registration', false)->orderBy('pos', 'ASC')->get(),
|
||||
// 'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
// 'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
|
||||
];
|
||||
if($step == 5){
|
||||
if ($step == 5) {
|
||||
return view('user.wizard.register_release', $data);
|
||||
}
|
||||
|
||||
|
|
@ -110,15 +110,16 @@ class WizardController extends Controller
|
|||
|
||||
public function payment()
|
||||
{
|
||||
if(!Auth::check()){
|
||||
if (! Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
if (! $user->account) {
|
||||
$account = UserAccount::create([]);
|
||||
$user->account_id = $account->id;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_payment'));
|
||||
}
|
||||
|
||||
|
|
@ -127,12 +128,12 @@ class WizardController extends Controller
|
|||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => 0,
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
'userHistoryWizardPayment' => $userHistoryWizardPayment,
|
||||
];
|
||||
|
||||
if($user->wizard == 20){
|
||||
if ($user->wizard == 20) {
|
||||
return view('user.wizard.register_payment', $data);
|
||||
}
|
||||
|
||||
|
|
@ -142,74 +143,79 @@ class WizardController extends Controller
|
|||
public function storeRegister($step = false)
|
||||
{
|
||||
|
||||
if (!Auth::check()) {
|
||||
if (! Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if (!$user->account) {
|
||||
$user->account = new UserAccount();
|
||||
if (! $user->account) {
|
||||
$user->account = new UserAccount;
|
||||
}
|
||||
|
||||
|
||||
$data = Request::all();
|
||||
if($step == 7 && Request::get('user_country_id')){
|
||||
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(
|
||||
$rules = [
|
||||
'accepted_data_protection' => 'required',
|
||||
'accepted_active' => 'required',
|
||||
'accepted_contract' => 'required'
|
||||
);
|
||||
'accepted_contract' => 'required',
|
||||
];
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'step' => $step,
|
||||
'user_levels' => UserLevel::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
//'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
//'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),,
|
||||
'user_levels' => UserLevel::where('active', true)->where('hide_registration', false)->orderBy('pos', 'ASC')->get(),
|
||||
// 'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
// 'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->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){
|
||||
if ($account->accepted_contract === null) {
|
||||
$account->accepted_contract = now();
|
||||
}
|
||||
if($account->data_protection === null){
|
||||
if ($account->data_protection === null) {
|
||||
$account->data_protection = now();
|
||||
}
|
||||
$account->save();
|
||||
if($user->agreement === null){
|
||||
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"){
|
||||
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', [1]));
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
||||
|
||||
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', [1]));
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
return $userRepo->reverse_charge_delete($data, $user, route('wizard_register', [1]));
|
||||
}
|
||||
|
||||
$rules = [
|
||||
'salutation' => 'required',
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
|
|
@ -221,9 +227,9 @@ class WizardController extends Controller
|
|||
'tax_number' => 'required_without:tax_identification_number',
|
||||
'tax_identification_number' => 'required_without:tax_number',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
);
|
||||
];
|
||||
|
||||
if (!Request::get('same_as_billing')) {
|
||||
if (! Request::get('same_as_billing')) {
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname' => 'required',
|
||||
'shipping_lastname' => 'required',
|
||||
|
|
@ -238,73 +244,77 @@ class WizardController extends Controller
|
|||
if ($validator->fails()) {
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_register', [1]))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
|
||||
$data = Request::all();
|
||||
$data['same_as_billing'] = Request::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$data['same_as_billing'] = Request::get('same_as_billing') == null ? 0 : 1;
|
||||
$data['birthday_day'] = isset($data['birthday_day']) ? $data['birthday_day'] : 1;
|
||||
$data['birthday_month'] = isset($data['birthday_month']) ? $data['birthday_month'] : 1;
|
||||
$data['birthday_year'] = isset($data['birthday_year']) ? $data['birthday_year'] : 1900;
|
||||
$data['birthday'] = $data['birthday_day'].".".$data['birthday_month'].".".$data['birthday_year'];
|
||||
$data['birthday'] = $data['birthday'] == "1.1.1900" ? null : $data['birthday'];
|
||||
$data['birthday'] = $data['birthday_day'].'.'.$data['birthday_month'].'.'.$data['birthday_year'];
|
||||
$data['birthday'] = $data['birthday'] == '1.1.1900' ? null : $data['birthday'];
|
||||
$user->account->fill($data)->save();
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
/* if ($step == 2) {
|
||||
//kein Ausweis hochladen - deaktiviert
|
||||
dd("deaktiviert");
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
/*
|
||||
if(Request::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Ausweis hinterlegt, bitte erst hochladen.'));
|
||||
$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 == 2) {
|
||||
//kein Ausweis hochladen - deaktiviert
|
||||
dd("deaktiviert");
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
/*
|
||||
if(Request::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Ausweis hinterlegt, bitte erst hochladen.'));
|
||||
$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 == 2) {
|
||||
$data = Request::all();
|
||||
if(Request::get('submit') === 'do'){
|
||||
if (Request::get('submit') === 'do') {
|
||||
$data = Request::all();
|
||||
|
||||
if($data['business_license_choose'] === "now"){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
|
||||
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', __('Kein Gewerbeschein hinterlegt, bitte erst hochladen.'));
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
}
|
||||
if($data['business_license_choose'] === "later"){
|
||||
if ($data['business_license_choose'] === 'later') {
|
||||
|
||||
}
|
||||
if($data['business_license_choose'] === "non"){
|
||||
if(!$data['non_business_license_reason'] || $data['non_business_license_reason'] == ""){
|
||||
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', __('Bitte gib eine Begründung ein, warum Du keinen Gewerbeschein benötigst.'));
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
}else{
|
||||
} else {
|
||||
$user->account->setNotice('business_license_reason', $data['non_business_license_reason']);
|
||||
}
|
||||
}
|
||||
|
|
@ -319,16 +329,18 @@ class WizardController extends Controller
|
|||
$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());
|
||||
|
||||
return $this->fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
|
||||
if ($step == 3) {
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
if(!isset($data['switchers-package-wizard'])){
|
||||
if (! isset($data['switchers-package-wizard'])) {
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Bitte wähle erst Deine Mitgildschaft aus.'));
|
||||
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
|
|
@ -336,12 +348,12 @@ class WizardController extends Controller
|
|||
$user->next_m_level = $data['switchers-package-wizard'];
|
||||
$user->wizard = 5;
|
||||
$user->release_account = now();
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'release_account', 'status'=>0]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action' => 'release_account', 'status' => 0]);
|
||||
$user->save();
|
||||
|
||||
if($user->isTestMode()){
|
||||
if ($user->isTestMode()) {
|
||||
$mail = config('app.info_test_mail');
|
||||
}else{
|
||||
} else {
|
||||
$mail = config('app.info_mail');
|
||||
}
|
||||
Mail::to($mail)->send(new MailReleaseAccount($user));
|
||||
|
|
@ -353,42 +365,43 @@ class WizardController extends Controller
|
|||
public function storeCreate($step = 0)
|
||||
{
|
||||
|
||||
if(!Auth::check()){
|
||||
if (! Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
if (! $user->account) {
|
||||
$user->account = new UserAccount;
|
||||
}
|
||||
|
||||
if($step == 10){
|
||||
$rules = array(
|
||||
if ($step == 10) {
|
||||
$rules = [
|
||||
'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', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->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){
|
||||
if ($account->accepted_contract === null) {
|
||||
$account->accepted_contract = now();
|
||||
}
|
||||
if($account->data_protection === null){
|
||||
if ($account->data_protection === null) {
|
||||
$account->data_protection = now();
|
||||
}
|
||||
$account->save();
|
||||
if($user->agreement === null){
|
||||
if ($user->agreement === null) {
|
||||
$user->agreement = now();
|
||||
}
|
||||
$user->wizard = 11;
|
||||
|
|
@ -396,54 +409,59 @@ class WizardController extends Controller
|
|||
|
||||
return redirect(route('wizard_create', [11]));
|
||||
}
|
||||
if($step == 11){
|
||||
if ($step == 11) {
|
||||
|
||||
if($user->isPasswort()){
|
||||
if ($user->isPasswort()) {
|
||||
$user->wizard = 12;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_create', [12]));
|
||||
}
|
||||
$rules = array(
|
||||
$rules = [
|
||||
'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', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->whereJsonContains('show_on', ['4', '5'])->orderBy('pos', 'ASC')->get(),
|
||||
'products_on_board' => Product::where('active', true)->whereJsonContains('show_on', '6')->orderBy('pos', 'ASC')->get(),
|
||||
];
|
||||
|
||||
return view('user.wizard.create', $data)->withErrors($validator);
|
||||
}
|
||||
|
||||
$user->fill([
|
||||
'password' => Hash::make(Request::get('password'))
|
||||
'password' => Hash::make(Request::get('password')),
|
||||
])->save();
|
||||
$user->wizard = 12;
|
||||
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_create', [12]));
|
||||
}
|
||||
if($step == 12){
|
||||
if ($step == 12) {
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
||||
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(
|
||||
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 = [
|
||||
'salutation' => 'required',
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
|
|
@ -455,16 +473,16 @@ class WizardController extends Controller
|
|||
'tax_number' => 'required_without:tax_identification_number',
|
||||
'tax_identification_number' => 'required_without:tax_number',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
);
|
||||
];
|
||||
|
||||
if(!Request::get('same_as_billing')){
|
||||
if (! Request::get('same_as_billing')) {
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
'shipping_address'=>'required',
|
||||
'shipping_zipcode'=>'required',
|
||||
'shipping_firstname' => 'required',
|
||||
'shipping_lastname' => 'required',
|
||||
'shipping_address' => 'required',
|
||||
'shipping_zipcode' => 'required',
|
||||
'shipping_city' => 'required',
|
||||
'shipping_salutation' => 'required'
|
||||
'shipping_salutation' => 'required',
|
||||
|
||||
]);
|
||||
}
|
||||
|
|
@ -474,7 +492,7 @@ class WizardController extends Controller
|
|||
}
|
||||
|
||||
$data = Request::all();
|
||||
$data['same_as_billing'] = Request::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$data['same_as_billing'] = Request::get('same_as_billing') == null ? 0 : 1;
|
||||
$user->account->fill($data)->save();
|
||||
|
||||
$user->wizard = 13;
|
||||
|
|
@ -484,14 +502,16 @@ class WizardController extends Controller
|
|||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_create', [13]));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function storePayment($step = 0){
|
||||
public function storePayment($step = 0)
|
||||
{
|
||||
|
||||
if(Request::get('switchers-package-wizard')){
|
||||
if (Request::get('switchers-package-wizard')) {
|
||||
$user = User::find(Auth::user()->id);
|
||||
Yard::instance('shopping')->destroy();
|
||||
$product = Product::find(Request::get('switchers-package-wizard'));
|
||||
|
|
@ -501,10 +521,10 @@ class WizardController extends Controller
|
|||
$user->abo_options = true;
|
||||
$user->save();
|
||||
}*/
|
||||
if($product && $product->active){
|
||||
//set membership product
|
||||
$image = "";
|
||||
if($product->images->count()){
|
||||
if ($product && $product->active) {
|
||||
// set membership product
|
||||
$image = '';
|
||||
if ($product->images->count()) {
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
/*need setGlobalTaxRate
|
||||
|
|
@ -515,23 +535,23 @@ class WizardController extends Controller
|
|||
Yard::setTax($cartItem->rowId, $product->getTaxWith(\App\Services\UserService::$user_country));
|
||||
}
|
||||
*/
|
||||
//Keine steuer
|
||||
// Keine steuer
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, $product->tax, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
Yard::instance('shopping')->setGlobalTaxRate(0);
|
||||
|
||||
//set onboarding products
|
||||
if(Request::get('products_on_board')){
|
||||
foreach (Request::get('products_on_board') as $product_on_board_id){
|
||||
// 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 = '';
|
||||
if ($product_on_board->images->count()) {
|
||||
$image = $product_on_board->images->first()->slug;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
need?
|
||||
$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),
|
||||
$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);
|
||||
|
|
@ -553,7 +573,6 @@ class WizardController extends Controller
|
|||
$data['is_from'] = 'wizard';
|
||||
$data['is_for'] = 'me';
|
||||
|
||||
|
||||
/*ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for buy intern
|
||||
|
|
@ -566,39 +585,41 @@ class WizardController extends Controller
|
|||
|
||||
]);*/
|
||||
Yard::instance('shopping')->putYardExtra('shopping_data', $data);
|
||||
//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]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
//return redirect()->secure($path);
|
||||
return redirect(route('user_checkout', [$identifier]));
|
||||
// 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]);
|
||||
|
||||
// $path = str_replace('http', 'https', $path);
|
||||
// return redirect()->secure($path);
|
||||
return redirect(route('user_checkout', [$identifier]));
|
||||
|
||||
}
|
||||
}
|
||||
\Session()->flash('alert-error', "Fehler beim Produkt");
|
||||
\Session()->flash('alert-error', 'Fehler beim Produkt');
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
public function delete($id, $relation){
|
||||
public function delete($id, $relation)
|
||||
{
|
||||
|
||||
if($relation === 'upload'){
|
||||
if ($relation === 'upload') {
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
$file = $user->files()->findOrFail($id);
|
||||
$identifier = $file->identifier;
|
||||
//remove file
|
||||
// remove file
|
||||
\Storage::disk('user')->delete($file->dir.$file->filename);
|
||||
$file->delete();
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
if($identifier === 'business_license'){
|
||||
\Session()->flash('alert-success', 'Datei gelöscht');
|
||||
if ($identifier === 'business_license') {
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_register', [2]));
|
||||
}
|
||||
}
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue