Kundenhoheit

This commit is contained in:
Kevin Adametz 2020-05-06 15:43:53 +02:00
parent d8b5206031
commit dc63fa9fb2
52 changed files with 2436 additions and 557 deletions

View file

@ -61,6 +61,7 @@ class ShoppingOrder extends Model
protected $fillable = [
'shopping_user_id',
'auth_user_id',
'member_id',
'country_id',
'user_shop_id',
'total',
@ -73,18 +74,6 @@ class ShoppingOrder extends Model
'mode',
];
protected $txaction_text = [
'paid' => "bezahlt",
'appointed' => "offen",
'failed' => "abbruch",
];
protected $txaction_color = [
'paid' => "success",
'appointed' => "warning",
'failed' => "danger",
];
public function shopping_user()
{
@ -101,6 +90,11 @@ class ShoppingOrder extends Model
return $this->belongsTo('App\Models\UserShop','user_shop_id');
}
//can null
public function member()
{
return $this->belongsTo('App\User','member_id');
}
//can null
public function auth_user()
{
@ -162,18 +156,15 @@ class ShoppingOrder extends Model
}
public function getFormattedTxaction(){
if($this->txaction && isset($this->txaction_text[$this->txaction])){
return $this->txaction_text[$this->txaction];
public function getItemsCount(){
$count = 0;
if($this->shopping_order_items){
foreach ($this->shopping_order_items as $shopping_order_item){
$count += $shopping_order_item->qty;
}
}
return "not";
}
public function getFormattedTxactionColor(){
if($this->txaction && isset($this->txaction_color[$this->txaction])){
return $this->txaction_color[$this->txaction];
}
return "danger";
return $count;
}