Free Shipping, Business Levels correction, Products Buying, Fonts
This commit is contained in:
parent
3f2fbd6d5b
commit
0341c9c189
197 changed files with 9161 additions and 329 deletions
|
|
@ -3,7 +3,9 @@ namespace App\Services;
|
|||
|
||||
|
||||
use App\User;
|
||||
use App\Models\UserLevel;
|
||||
use App\Mail\MailCheckout;
|
||||
use App\Models\ProductBuying;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\UserCreditItem;
|
||||
use App\Models\ShoppingPayment;
|
||||
|
|
@ -96,6 +98,26 @@ class Payment
|
|||
]);
|
||||
}
|
||||
|
||||
public static function addBuyingRestriction(User $user, $product_id){
|
||||
ProductBuying::create([
|
||||
'user_id' => $user->id,
|
||||
'product_id' => $product_id,
|
||||
'amount' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
public static function updateUserLevel(User $user, $to_level_id){
|
||||
//nur updaten, wenn der user->m_level kleiner ist als $to_level_id
|
||||
if($user->user_level){
|
||||
$ToUserLevel = UserLevel::find($to_level_id);
|
||||
if($user->user_level->pos < $ToUserLevel->pos){
|
||||
$user->m_level = $to_level_id;
|
||||
}
|
||||
}else{
|
||||
$user->m_level = $to_level_id;
|
||||
}
|
||||
$user->save();
|
||||
}
|
||||
/*
|
||||
Wir bei Zahlung aufgerufen.
|
||||
Betätigung durch Payone oder Zahlung auf MIVITA Rechnung
|
||||
|
|
@ -113,9 +135,12 @@ class Payment
|
|||
if($shopping_order->shopping_order_items && $shopping_order->auth_user_id){
|
||||
foreach($shopping_order->shopping_order_items as $shopping_order_item){
|
||||
if($shopping_order_item->product){
|
||||
$user = User::findOrFail($shopping_order->auth_user_id);
|
||||
$user->save();
|
||||
if($shopping_order_item->product->buying_restriction){
|
||||
self::addBuyingRestriction($user, $shopping_order_item->product->id);
|
||||
}
|
||||
if($shopping_order_item->product->action){
|
||||
$user = User::findOrFail($shopping_order->auth_user_id);
|
||||
$user->save();
|
||||
$send_link = true;
|
||||
//new date
|
||||
$date = \Carbon::now()->modify('1 year');
|
||||
|
|
@ -144,7 +169,7 @@ class Payment
|
|||
}
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_lead_upgrade'){
|
||||
if($shopping_order_item->product->upgrade_to_id){
|
||||
$user->m_level = $shopping_order_item->product->upgrade_to_id;
|
||||
self::updateUserLevel($user, $shopping_order_item->product->upgrade_to_id);
|
||||
}
|
||||
}
|
||||
$user->save();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue