main system

This commit is contained in:
Kevin Adametz 2021-01-15 18:16:31 +01:00
parent 0baac018a2
commit a96d7d5c77
115 changed files with 4589 additions and 557 deletions

View file

@ -176,7 +176,7 @@ class Product extends Model
'show_order' => 'Wird immer als Option angezeigt',
'upgrade' => 'Produktupgrade zur Produkt ID',
'upgrade_member' => 'Beraterupgrade zur Karriere ID',
'proportional_voucher' => 'Anteiliger Gutschein Berater',
//'proportional_voucher' => 'Anteiliger Gutschein Berater',
];
@ -189,22 +189,22 @@ class Product extends Model
];
public $showATs = [
0 => 'Nur Kunden Shop',
1 => 'Kunden + Berater Shop',
2 => 'Nur Berater Shop',
0 => 'Nur Kunden Bestellungen',
1 => 'Kunden + Berater Bestellungen',
2 => 'Nur Berater Bestellungen',
3 => 'Registrierung / Mitgliedschaft Berater',
4 => 'Nur Mitgliedschaft Berater',
5 => 'Onboarding Berater',
6 => 'Onboarding Berater + Berater Shop',
//5 => 'Onboarding Berater',
//6 => 'Onboarding Berater + Berater Shop',
7 => 'zur internen Berechnung',
];
public $actions = [
0 => 'payment_for_account',
1 => 'payment_for_shop',
2 => 'payment_for_shop_upgrade',
4 => 'payment_for_lead_upgrade',
// 1 => 'payment_for_shop',
// 2 => 'payment_for_shop_upgrade',
// 4 => 'payment_for_lead_upgrade',
];

111
app/Models/Setting.php Normal file
View file

@ -0,0 +1,111 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
/**
* Class Setting
*
* @property int $id
* @property string|null $identifier
* @property string $slug
* @property int $referenz
* @property string|null $action
* @property string|null $object
* @property string|null $content
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
*/
class Setting extends Model
{
use Sluggable;
protected $table = 'settings';
protected $casts = [
'referenz' => 'int',
'status' => 'int',
'object' => 'array'
];
protected $fillable = [
'identifier',
'slug',
'referenz',
'action',
'object',
'full_text',
'text',
'status',
'type'
];
protected static $types = [
'object' => 'Object',
'full_text' => 'Full Text',
'text' => 'Text',
];
public function sluggable()
{
return [
'slug' => [
'source' => 'name'
]
];
}
public static function getContentBySlug($slug){
$content = self::whereSlug(trim($slug))->first();
if($content){
switch ($content->type){
case 'object':
return $content->object;
break;
case 'full_text':
return $content->full_text;
break;
case 'text':
return $content->text;
break;
}
}
return false;
}
public static function setContentBySlug($slug, $value, $type = "full_text"){
$content = self::whereSlug(trim($slug))->first();
if(!$content) {
$content = self::create([
'slug' => $slug,
'type' => $type,
]);
}
$content->type = $type;
switch ($content->type){
case 'object':
$content->object = $value;
break;
case 'full_text':
$content->full_text = $value;
break;
case 'text':
$content->text = $value;
break;
}
$content->save();
return $content;
}
}

View file

@ -71,7 +71,7 @@ class ShippingPrice extends Model
$this->attributes['factor'] = $value ? Util::reFormatNumber($value) : null;
}
public function setTaxAttribute($value)
public function setTaxRateAttribute($value)
{
$this->attributes['tax_rate'] = $value ? Util::reFormatNumber($value) : null;
}

View file

@ -185,6 +185,10 @@ class ShoppingOrder extends Model
return $this->hasMany('App\Models\ShoppingPayment', 'shopping_order_id');
}
public function shopping_payment_last(){
return $this->hasOne('App\Models\ShoppingPayment', 'shopping_order_id')->latest();
}
public function setUserHistoryValue($values = []){
if($user_history = $this->user_history){
foreach ($values as $key=>$val){