Abo Einmalprodukte und Bestätigung abschließen
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
2bdc9ada3c
commit
2269ce031f
57 changed files with 3647 additions and 371 deletions
|
|
@ -19,6 +19,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \App\Models\Product $product
|
||||
* @property-read \App\Models\ShoppingOrder $shopping_order
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem query()
|
||||
|
|
@ -31,32 +32,43 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereShoppingOrderId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereUpdatedAt($value)
|
||||
*
|
||||
* @property float|null $tax_rate
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property string|null $user_deleted_at
|
||||
*
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrderItem onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereTaxRate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereUserDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrderItem withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrderItem withoutTrashed()
|
||||
*
|
||||
* @property int|null $comp
|
||||
* @property float|null $price_net
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereComp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem wherePriceNet($value)
|
||||
*
|
||||
* @property int|null $homeparty_id
|
||||
* @property-read \App\Models\Homeparty|null $homeparty
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereHomepartyId($value)
|
||||
*
|
||||
* @property string|null $tax
|
||||
* @property string|null $price_vk_net
|
||||
* @property string|null $discount
|
||||
* @property int|null $points
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereDiscount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem wherePoints($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem wherePriceVkNet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereTax($value)
|
||||
*
|
||||
* @property int|null $shopping_collect_order_id
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereShoppingCollectOrderId($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingOrderItem extends Model
|
||||
|
|
@ -64,6 +76,7 @@ class ShoppingOrderItem extends Model
|
|||
protected $table = 'shopping_order_items';
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
protected $fillable = [
|
||||
|
|
@ -73,6 +86,7 @@ class ShoppingOrderItem extends Model
|
|||
'homeparty_id',
|
||||
'shopping_collect_order_id',
|
||||
'comp',
|
||||
'is_abo_addon',
|
||||
'qty',
|
||||
'price',
|
||||
'price_net',
|
||||
|
|
@ -83,6 +97,7 @@ class ShoppingOrderItem extends Model
|
|||
'points',
|
||||
'slug',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'qty' => 'int',
|
||||
'price' => 'float',
|
||||
|
|
@ -92,21 +107,38 @@ class ShoppingOrderItem extends Model
|
|||
'price_vk_net' => 'float',
|
||||
'discount' => 'float',
|
||||
'points' => 'float',
|
||||
'is_abo_addon' => 'bool',
|
||||
];
|
||||
|
||||
public function shopping_order()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShoppingOrder','shopping_order_id');
|
||||
return $this->belongsTo('App\Models\ShoppingOrder', 'shopping_order_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reine Abo-Positionen (keine einmalig hinzugefügten Artikel).
|
||||
*/
|
||||
public function scopeAboItems($query)
|
||||
{
|
||||
return $query->where('is_abo_addon', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Einmalig zum Abo-Versand hinzugefügte Artikel aus dem normalen Bestellsortiment.
|
||||
*/
|
||||
public function scopeAddonItems($query)
|
||||
{
|
||||
return $query->where('is_abo_addon', true);
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Product','product_id');
|
||||
return $this->belongsTo('App\Models\Product', 'product_id');
|
||||
}
|
||||
|
||||
public function homeparty()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Homeparty','homeparty_id');
|
||||
return $this->belongsTo('App\Models\Homeparty', 'homeparty_id');
|
||||
}
|
||||
|
||||
public function getFormattedPrice()
|
||||
|
|
@ -139,7 +171,6 @@ class ShoppingOrderItem extends Model
|
|||
return formatNumber($this->attributes['tax']);
|
||||
}
|
||||
|
||||
|
||||
public function getFormattedDiscount()
|
||||
{
|
||||
return cleanNumberFormat($this->attributes['discount']);
|
||||
|
|
@ -147,7 +178,7 @@ class ShoppingOrderItem extends Model
|
|||
|
||||
public function getFormattedTotalPriceNet()
|
||||
{
|
||||
return formatNumber($this->attributes['price_net'] * $this->attributes['qty']);
|
||||
return formatNumber($this->attributes['price_net'] * $this->attributes['qty']);
|
||||
}
|
||||
|
||||
public function setPointsAttribute($value)
|
||||
|
|
@ -157,6 +188,6 @@ class ShoppingOrderItem extends Model
|
|||
|
||||
public function getFormattedPoints()
|
||||
{
|
||||
return isset($this->attributes['points']) ? formatNumber($this->attributes['points']) : "";
|
||||
return isset($this->attributes['points']) ? formatNumber($this->attributes['points']) : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue