Updates to 03-2025
This commit is contained in:
parent
bfa3bb1df4
commit
9ae662f63e
243 changed files with 12580 additions and 12018 deletions
|
|
@ -249,9 +249,8 @@ class Product extends Model
|
|||
8 => 'Mitgliedschaft Berater',
|
||||
9 => 'Onboarding Berater',
|
||||
10 => 'zur internen Berechnung',
|
||||
12 => 'Abo-ShopBerater',
|
||||
13 => 'Abo-ShopBeraterKunden',
|
||||
|
||||
12 => 'Abo-BasisProdukt',
|
||||
13 => 'Abo-AddonProdukt',
|
||||
];
|
||||
|
||||
public $actions = [
|
||||
|
|
@ -270,7 +269,18 @@ class Product extends Model
|
|||
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
/************* ✨ Codeium Command ⭐ *************/
|
||||
/**
|
||||
* Configure the model for auto-generating a slug.
|
||||
*
|
||||
* This method returns an array defining the attributes used
|
||||
* to generate the slug for the model. In this case, the 'name'
|
||||
* attribute is used as the source for generating the slug.
|
||||
*
|
||||
* @return array Configuration for slug generation.
|
||||
*/
|
||||
|
||||
/****** e935bd41-f49b-4736-9603-2da86dc27f25 *******/ public function sluggable() : array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
|
|
@ -393,23 +403,25 @@ class Product extends Model
|
|||
}
|
||||
|
||||
/*price by user Factor*/
|
||||
private function calcPriceUserFactor($price){
|
||||
private function calcPriceUserFactor($price, $user=null){
|
||||
if($this->no_commission){
|
||||
return $price;
|
||||
}
|
||||
if(\Auth::user() && \Auth::user()->user_level){
|
||||
$margin = ((\Auth::user()->user_level->margin -100)*-1) / 100;
|
||||
$user = $user ? $user : \Auth::user();
|
||||
if($user && $user->user_level){
|
||||
$margin = (($user->user_level->margin -100)*-1) / 100;
|
||||
$price = $price * $margin;
|
||||
}
|
||||
return $price;
|
||||
}
|
||||
|
||||
private function calcPriceUserCommission($price){
|
||||
private function calcPriceUserCommission($price, $user){
|
||||
if($this->no_commission){
|
||||
return $price;
|
||||
}
|
||||
if(\Auth::user() && \Auth::user()->user_level){
|
||||
$margin = \Auth::user()->user_level->margin;
|
||||
$user = $user ? $user : \Auth::user();
|
||||
if($user && $user->user_level){
|
||||
$margin = $user->user_level->margin;
|
||||
$price = $price / 100 * $margin;
|
||||
}
|
||||
return $price;
|
||||
|
|
@ -423,13 +435,13 @@ class Product extends Model
|
|||
return $price / $tax_rate;
|
||||
}
|
||||
//price calu with
|
||||
public function getPriceWith(Bool $net = true, Bool $ufactor = true, $country = null, $commission=false){
|
||||
public function getPriceWith(Bool $net = true, Bool $ufactor = true, $country = null, $commission=false, $user = null){
|
||||
$price = isset($this->attributes['price']) ? $this->attributes['price'] : null;
|
||||
$cprice = $country ? $this->getCPrice($country) : null;
|
||||
$price = $cprice ? $cprice : $price;
|
||||
$price = $net ? $this->calcPriceNet($price, $country) : $price;
|
||||
$price = $ufactor ? $this->calcPriceUserFactor($price) : $price;
|
||||
$price = $commission ? $this->calcPriceUserCommission($price) : $price;
|
||||
$price = $ufactor ? $this->calcPriceUserFactor($price, $user) : $price;
|
||||
$price = $commission ? $this->calcPriceUserCommission($price, $user) : $price;
|
||||
|
||||
return round($price, 2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue