This commit is contained in:
Kevin Adametz 2024-08-05 12:05:24 +02:00
parent 04d677d37a
commit bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions

View file

@ -118,6 +118,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereShoppingCollectOrderId($value)
* @property string|null $remarks
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereRemarks($value)
* @property string|null $language
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereLanguage($value)
* @mixin \Eloquent
*/
class ShoppingUser extends Model
@ -134,6 +136,7 @@ class ShoppingUser extends Model
'member_id',
'number',
'is_like',
'language',
'billing_salutation',
'billing_company',
'billing_firstname',
@ -215,6 +218,10 @@ class ShoppingUser extends Model
return $this->hasOne('App\Models\ShoppingOrder','shopping_user_id');
}
public function getLocale(){
return $this->language ? $this->language : \App::getLocale();
}
public function setNotice($key, $value){
$notice = $this->notice;
$notice[$key] = $value;
@ -262,7 +269,7 @@ class ShoppingUser extends Model
case 'membership':
return 2;
case 'user_order':
return $this->is_for === 'me' ? 3 : 4;
return ($this->is_for === 'me' || $this->is_for === 'abo_me') ? 3 : 4;
case 'homeparty':
return 5;
case 'shopping':
@ -275,6 +282,18 @@ class ShoppingUser extends Model
return 0;
}
public function setIsForAttribute($value){
if($value === 'abo-me' || $value === 'me'){
$this->attributes['is_for'] = 'me';
return;
}
if($value === 'ot-member' || $value === 'ot-customer' || $value === 'abo-ot-member' || $value === 'abo-ot-customer'){
$this->attributes['is_for'] = 'ot';
return;
}
$this->attributes['is_for'] = $value;
}
public function getAPIShippedType() {
if($this->shopping_order){
@ -282,4 +301,15 @@ class ShoppingUser extends Model
}
return "free";
}
public function getFullNameAsArray() {
return [
'company' => $this->billing_company,
'salutation' => $this->billing_salutation,
'firstname' => $this->billing_firstname,
'lastname' => $this->billing_lastname,
'email' => $this->billing_email,
];
}
}