Kundenhoheit
This commit is contained in:
parent
d8b5206031
commit
dc63fa9fb2
52 changed files with 2436 additions and 557 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -88,4 +89,7 @@ class ShoppingPayment extends Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getPaymentAmount(){
|
||||
return Util::formatNumber($this->amount/100)." ".$this->currency;
|
||||
}
|
||||
}
|
||||
|
|
@ -80,7 +80,13 @@ class ShoppingUser extends Model
|
|||
{
|
||||
protected $table = 'shopping_users';
|
||||
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'auth_user_id',
|
||||
'member_id',
|
||||
'number',
|
||||
'is_like',
|
||||
'billing_salutation',
|
||||
'billing_company',
|
||||
'billing_firstname',
|
||||
|
|
@ -104,10 +110,25 @@ class ShoppingUser extends Model
|
|||
'shipping_city',
|
||||
'shipping_country_id',
|
||||
'shipping_phone',
|
||||
'notice',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'notice' => 'array',
|
||||
'is_like' => 'bool',
|
||||
'accepted_data_checkbox' => 'bool',
|
||||
'same_as_billing' => 'bool',
|
||||
];
|
||||
|
||||
|
||||
//can null
|
||||
public function member()
|
||||
{
|
||||
return $this->belongsTo('App\User','member_id');
|
||||
}
|
||||
public function auth_user()
|
||||
{
|
||||
return $this->belongsTo('App\User','auth_user_id');
|
||||
}
|
||||
public function billing_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country','billing_country_id');
|
||||
|
|
@ -128,4 +149,23 @@ class ShoppingUser extends Model
|
|||
return $this->hasOne('App\Models\ShoppingOrder','shopping_user_id');
|
||||
}
|
||||
|
||||
public function setNotice($key, $value){
|
||||
$notice = $this->notice;
|
||||
$notice[$key] = $value;
|
||||
$this->notice = $notice;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function getNotice($key){
|
||||
return isset($this->notice[$key]) ? $this->notice[$key] : false;
|
||||
}
|
||||
|
||||
public function removeNotice($key){
|
||||
$notice = $this->notice;
|
||||
if(isset($notice[$key])){
|
||||
unset($notice[$key]);
|
||||
}
|
||||
$this->notice = $notice;
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
|
@ -129,7 +129,6 @@ class UserAccount extends Model
|
|||
protected $casts = [
|
||||
'payment_data' => 'array',
|
||||
'notice' => 'array',
|
||||
|
||||
];
|
||||
|
||||
use SoftDeletes;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue