promotion 1.0
This commit is contained in:
parent
1cc8e025a1
commit
570d428b1c
60 changed files with 1596 additions and 272 deletions
|
|
@ -53,6 +53,10 @@ use Illuminate\Database\Eloquent\Collection;
|
|||
* @property-read int|null $promotion_admin_products_active_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereShop($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereType($value)
|
||||
* @property string|null $user_description
|
||||
* @property string|null $user_about
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereUserAbout($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereUserDescription($value)
|
||||
*/
|
||||
class PromotionAdmin extends Model
|
||||
{
|
||||
|
|
@ -77,6 +81,8 @@ class PromotionAdmin extends Model
|
|||
'type',
|
||||
'name',
|
||||
'description',
|
||||
'user_description',
|
||||
'user_about',
|
||||
'from',
|
||||
'to',
|
||||
'shop',
|
||||
|
|
|
|||
126
app/Models/PromotionUserOrder.php
Normal file
126
app/Models/PromotionUserOrder.php
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class PromotionUserOrder
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $promotion_admin_id
|
||||
* @property int $promotion_user_id
|
||||
* @property int $promotion_user_product_id
|
||||
* @property int $product_id
|
||||
* @property int $shopping_order_item_id
|
||||
* @property int $shopping_order_id
|
||||
* @property int $shopping_user_id
|
||||
* @property int|null $qty
|
||||
* @property float|null $price
|
||||
* @property float|null $price_net
|
||||
* @property float|null $tax_rate
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Product $product
|
||||
* @property PromotionAdmin $promotion_admin
|
||||
* @property PromotionUser $promotion_user
|
||||
* @property PromotionUserProduct $promotion_user_product
|
||||
* @property ShoppingOrder $shopping_order
|
||||
* @property ShoppingOrderItem $shopping_order_item
|
||||
* @property ShoppingUser $shopping_user
|
||||
* @package App\Models
|
||||
* @property int|null $status
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder wherePrice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder wherePriceNet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder wherePromotionAdminId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder wherePromotionUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder wherePromotionUserProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereQty($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereShoppingOrderId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereShoppingOrderItemId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereShoppingUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereTaxRate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class PromotionUserOrder extends Model
|
||||
{
|
||||
protected $table = 'promotion_user_orders';
|
||||
|
||||
protected $casts = [
|
||||
'promotion_admin_id' => 'int',
|
||||
'promotion_user_id' => 'int',
|
||||
'promotion_user_product_id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'shopping_order_item_id' => 'int',
|
||||
'shopping_order_id' => 'int',
|
||||
'shopping_user_id' => 'int',
|
||||
'qty' => 'int',
|
||||
'price' => 'float',
|
||||
'price_net' => 'float',
|
||||
'tax_rate' => 'float',
|
||||
'status' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'promotion_admin_id',
|
||||
'promotion_user_id',
|
||||
'promotion_user_product_id',
|
||||
'product_id',
|
||||
'shopping_order_item_id',
|
||||
'shopping_order_id',
|
||||
'shopping_user_id',
|
||||
'qty',
|
||||
'price',
|
||||
'price_net',
|
||||
'tax_rate',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function promotion_admin()
|
||||
{
|
||||
return $this->belongsTo(PromotionAdmin::class);
|
||||
}
|
||||
|
||||
public function promotion_user()
|
||||
{
|
||||
return $this->belongsTo(PromotionUser::class);
|
||||
}
|
||||
|
||||
public function promotion_user_product()
|
||||
{
|
||||
return $this->belongsTo(PromotionUserProduct::class);
|
||||
}
|
||||
|
||||
public function shopping_order()
|
||||
{
|
||||
return $this->belongsTo(ShoppingOrder::class);
|
||||
}
|
||||
|
||||
public function shopping_order_item()
|
||||
{
|
||||
return $this->belongsTo(ShoppingOrderItem::class);
|
||||
}
|
||||
|
||||
public function shopping_user()
|
||||
{
|
||||
return $this->belongsTo(ShoppingUser::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int|null $num_comp
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereNumComp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice wherePriceComp($value)
|
||||
* @property int|null $shipping_for
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShippingPrice whereShippingFor($value)
|
||||
*/
|
||||
class ShippingPrice extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -99,6 +99,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereShippedAt($value)
|
||||
* @property string|null $invoice_number
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereInvoiceNumber($value)
|
||||
* @property int|null $promotion_user_id
|
||||
* @property string|null $shipping_option
|
||||
* @property-read \App\Models\PromotionUser|null $promotion_user
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder wherePromotionUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereShippingOption($value)
|
||||
*/
|
||||
class ShoppingOrder extends Model
|
||||
{
|
||||
|
|
@ -110,7 +115,9 @@ class ShoppingOrder extends Model
|
|||
protected $fillable = [
|
||||
'shopping_user_id',
|
||||
'auth_user_id',
|
||||
'promotion_user_id',
|
||||
'member_id',
|
||||
'payment_for',
|
||||
'country_id',
|
||||
'user_shop_id',
|
||||
'total',
|
||||
|
|
@ -135,6 +142,7 @@ class ShoppingOrder extends Model
|
|||
'mode',
|
||||
'shipped',
|
||||
'shipped_at',
|
||||
'shipping_option',
|
||||
'tracking'
|
||||
];
|
||||
|
||||
|
|
@ -152,6 +160,15 @@ class ShoppingOrder extends Model
|
|||
10 => 'storniert'
|
||||
];
|
||||
|
||||
public static $paymentForTypes = [
|
||||
0 => '',
|
||||
1 => 'wizzard',
|
||||
2 => 'user_order me',
|
||||
3 => 'user_order ot',
|
||||
4 => 'Promotion',
|
||||
10 => ''
|
||||
];
|
||||
|
||||
public static $apiShippedTypes = [
|
||||
0 => 'open', //(Fullfilment durch Händler)',
|
||||
1 => 'process', //(Fullfilment durch MIVITA: nicht Versand)
|
||||
|
|
@ -183,6 +200,11 @@ class ShoppingOrder extends Model
|
|||
return $this->belongsTo('App\Models\ShippingCountry','country_id');
|
||||
}
|
||||
|
||||
public function promotion_user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\PromotionUser','promotion_user_id');
|
||||
}
|
||||
|
||||
//can null
|
||||
public function member()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @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 $free_product_id
|
||||
* @property-read \App\Models\PromotionUserProduct|null $promotion_user_product
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereFreeProductId($value)
|
||||
*/
|
||||
class ShoppingOrderItem extends Model
|
||||
{
|
||||
|
|
@ -58,6 +61,7 @@ class ShoppingOrderItem extends Model
|
|||
'row_id',
|
||||
'product_id',
|
||||
'comp',
|
||||
'free_product_id',
|
||||
'qty',
|
||||
'price',
|
||||
'price_net',
|
||||
|
|
@ -97,4 +101,14 @@ class ShoppingOrderItem extends Model
|
|||
return formatNumber($this->attributes['price_net'] * $this->attributes['qty']);
|
||||
}
|
||||
|
||||
public function isFreeProduct()
|
||||
{
|
||||
return $this->free_product_id > 0 ? true : false;
|
||||
}
|
||||
|
||||
public function promotion_user_product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\PromotionUserProduct','free_product_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -88,6 +88,9 @@ class ShoppingPayment extends Model
|
|||
if($this->clearingtype === 'fnc') {
|
||||
return 'Rechnung';
|
||||
}
|
||||
if($this->clearingtype === 'non') {
|
||||
return 'keine';
|
||||
}
|
||||
}
|
||||
|
||||
public function getPaymentAmount(){
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ class UserPayCredit extends Model
|
|||
2 => 'deduction from payment',
|
||||
3 => 'manually added credit',
|
||||
4 => 'return from order',
|
||||
|
||||
5 => 'deduction from promotion',
|
||||
6 => 'return from promotion',
|
||||
];
|
||||
protected $table = 'user_pay_credits';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue