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

@ -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();
}
}