01 2022 Microsite Promotion

This commit is contained in:
Kevin Adametz 2022-01-18 18:30:14 +01:00
parent 3f1fb9377d
commit 38e7fd504a
39 changed files with 761 additions and 336 deletions

View file

@ -2,6 +2,7 @@
namespace App\Models;
use App\Services\Type;
use Illuminate\Database\Eloquent\Model;
use Cviebrock\EloquentSluggable\Sluggable;
@ -53,10 +54,10 @@ class Category extends Model
protected $table = 'categories';
protected $casts = ['trans_name' => 'array', 'trans_headline' => 'array'];
protected $casts = ['trans_name' => 'array', 'trans_headline' => 'array', 'show_on' => 'array'];
protected $fillable = [
'parent_id', 'name', 'headline', 'pos', 'active',
'parent_id', 'name', 'headline', 'pos', 'active', 'show_on'
];
public function sluggable()
@ -133,4 +134,15 @@ class Category extends Model
return rtrim($ret, ', ');
}
public function getShowOnTypes(){
$ret = [];
if(is_array($this->show_on)){
foreach($this->show_on as $show){
$ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
}
}
return $ret;
}
}

View file

@ -6,6 +6,7 @@
namespace App\Models;
use App\Services\Type;
use App\Services\Util;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
@ -65,35 +66,16 @@ class PaymentMethod extends Model
'active'
];
public static $showATs = [
0 => 'Nur Kunden Shop',
1 => 'Nur Vertriebspartner Shop',
2 => 'Kunden + Vertriebspartner Shop',
3 => 'Nur Reg/Mitgliedschaft Vertriebspartner',
4 => 'Kunden + Vertriebspartner Shop + Reg/Mitgliedschaft',
5 => 'Vertriebspartner Shop + Reg/Mitgliedschaft',
9 => 'überall',
];
public static $showONs = [
1 => 'Kunden Bestellungen',
2 => 'Vertriebspartner Bestellungen',
3 => 'Microsite',
4 => 'Registrierung Vertriebspartner',
5 => 'Mitgliedschaft Vertriebspartner',
//6 => 'Onboarding Berater',
10 => 'überall',
];
public function getShowAtType(){
return isset(self::$showATs[$this->show_at]) ? self::$showATs[$this->show_at] : '-';
return isset(Type::$payShowATs[$this->show_at]) ? Type::$payShowATs[$this->show_at] : '-';
}
public function getShowOnTypes(){
$ret = [];
if($this->show_on){
foreach($this->show_on as $show){
$ret[] = isset(self::$showONs[$show]) ? self::$showONs[$show] : '-';
$ret[] = isset(Type::$payShowONs[$show]) ? Type::$payShowONs[$show] : '-';
}
}
return $ret;

View file

@ -2,6 +2,7 @@
namespace App\Models;
use App\Services\Type;
use App\Services\Util;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
@ -218,27 +219,7 @@ class Product extends Model
4 => 'KG',
];
public $showATs = [
0 => 'Nur Kunden Bestellungen',
1 => 'Kunden + Vertriebspartner Bestellungen',
2 => 'Nur Vertriebspartner Bestellungen',
3 => 'Registrierung / Mitgliedschaft Vertriebspartner',
4 => 'Nur Mitgliedschaft Vertriebspartner',
//5 => 'Onboarding Vertriebspartner',
//6 => 'Onboarding Vertriebspartner + Vertriebspartner Shop',
7 => 'zur internen Berechnung',
];
public $showONs = [
1 => 'Kunden Bestellungen',
2 => 'Vertriebspartner Bestellungen',
3 => 'Microsite',
4 => 'Registrierung Vertriebspartner',
5 => 'Mitgliedschaft Vertriebspartner',
//6 => 'Onboarding Berater',
10 => 'zur internen Berechnung',
];
public $actions = [
@ -439,13 +420,13 @@ class Product extends Model
return isset($this->unitTypes[$this->unit]) ? $this->unitTypes[$this->unit] : '-';
}
public function getShowAtType(){
return isset($this->showATs[$this->show_at]) ? $this->showATs[$this->show_at] : '-';
return isset(Type::$showATs[$this->show_at]) ? Type::$showATs[$this->show_at] : '-';
}
public function getShowOnTypes(){
$ret = [];
foreach($this->show_on as $show){
$ret[] = isset($this->showONs[$show]) ? $this->showONs[$show] : '-';
$ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
}
return $ret;
}

View file

@ -2,6 +2,7 @@
namespace App\Models;
use App\Services\Type;
use Illuminate\Database\Eloquent\Model;
/**
@ -28,8 +29,12 @@ class ProductCategory extends Model
{
protected $table = 'product_categories';
protected $casts = [
'show_on' => 'array',
];
protected $fillable = [
'product_id', 'category_id',
'pos', 'product_id', 'category_id', 'show_on'
];
public function product()
@ -42,4 +47,12 @@ class ProductCategory extends Model
return $this->belongsTo('App\Models\Category', 'category_id');
}
public function getShowOnTypes(){
$ret = [];
foreach($this->show_on as $show){
$ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
}
return $ret;
}
}

View file

@ -80,6 +80,13 @@ class Shipping extends Model
}
public function getShippingPricesBy($shipping_for){
return $this->hasMany('App\Models\ShippingPrice', 'shipping_id', 'id')->where('shipping_for', $shipping_for);
return ShippingPrice::where('shipping_id', $this->id)->where('shipping_for', $shipping_for)->get();
}
public function getShippingPricesFirstBy($shipping_for){
return ShippingPrice::where('shipping_id', $this->id)->where('shipping_for', $shipping_for) ->orderBy('price', 'ASC')->first();
}
}