update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
90
dev/app-bak/Models/UserAboItem.php
Normal file
90
dev/app-bak/Models/UserAboItem.php
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Yard;
|
||||
|
||||
/**
|
||||
* Class UserAboItem
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_abo_id
|
||||
* @property int $product_id
|
||||
* @property int|null $comp
|
||||
* @property int $qty
|
||||
* @property int $status
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Product $product
|
||||
* @property UserAbo $user_abo
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereComp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereQty($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereUserAboId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserAboItem extends Model
|
||||
{
|
||||
protected $table = 'user_abo_items';
|
||||
|
||||
protected $casts = [
|
||||
'user_abo_id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'comp' => 'int',
|
||||
'qty' => 'int',
|
||||
'status' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_abo_id',
|
||||
'product_id',
|
||||
'comp',
|
||||
'qty',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function user_abo()
|
||||
{
|
||||
return $this->belongsTo(UserAbo::class);
|
||||
}
|
||||
|
||||
public function getPrice()
|
||||
{
|
||||
$ufactor = $this->user_abo->is_for === 'me' ? true : false;
|
||||
$tax_free = $ufactor ? true : Yard::instance('shopping')->getUserTaxFree();
|
||||
$userCountry = Yard::instance('shopping')->getUserCountry();
|
||||
return $this->product->getPriceWith($tax_free, $ufactor, $userCountry);
|
||||
}
|
||||
|
||||
|
||||
public function getFormattedPrice(){
|
||||
/** der Preis wird für den User berechnet */
|
||||
return Util::formatNumber($this->getPrice());
|
||||
}
|
||||
|
||||
|
||||
public function getFormattedTotalPrice(){
|
||||
/** der Preis wird für den User berechnet */
|
||||
return Util::formatNumber($this->getPrice() * $this->qty);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue