testemich Promotion
This commit is contained in:
parent
38e7fd504a
commit
a0f4eda6ea
83 changed files with 1690 additions and 504 deletions
|
|
@ -71,7 +71,8 @@ class PromotionUserOrder extends Model
|
|||
'price' => 'float',
|
||||
'price_net' => 'float',
|
||||
'tax_rate' => 'float',
|
||||
'status' => 'int'
|
||||
'status' => 'int',
|
||||
'pick_up' => 'bool',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
|
|
@ -86,9 +87,15 @@ class PromotionUserOrder extends Model
|
|||
'price',
|
||||
'price_net',
|
||||
'tax_rate',
|
||||
'status'
|
||||
'status',
|
||||
'pick_up'
|
||||
];
|
||||
|
||||
public static $statusTypes = [
|
||||
0 => 'bestellt',
|
||||
10 => 'storniert'
|
||||
];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
|
|
@ -123,4 +130,29 @@ class PromotionUserOrder extends Model
|
|||
{
|
||||
return $this->belongsTo(ShoppingUser::class);
|
||||
}
|
||||
|
||||
public function getStatusType(){
|
||||
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
|
||||
}
|
||||
|
||||
public function setStatusTxAction($txaction){
|
||||
|
||||
switch ($txaction) {
|
||||
case 'none':
|
||||
$this->status = 10;
|
||||
break;
|
||||
case 'open':
|
||||
$this->status = 0;
|
||||
break;
|
||||
case 'paid':
|
||||
$this->status = 3;
|
||||
break;
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function setStatusShipped($shipped){
|
||||
$this->status = $shipped === 'cancel' ? 10 : 0;
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue