62 lines
2.0 KiB
PHP
62 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\YiiModels\Drug;
|
|
use App\Models\YiiModels\DrugstoreDrug;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* App\Models\ProductOrderItem
|
|
*
|
|
* @property int $id
|
|
* @property int $product_order_id 商品订单id
|
|
* @property int $drug_id 商品id
|
|
* @property string|null $drug_image 图片
|
|
* @property int $number 数量
|
|
* @property string $price 价格
|
|
* @property string $drug_name 商品名称
|
|
* @property string|null $small_info 商品简介
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read \App\Models\YiiModels\Drug|null $drug 药品
|
|
* @property-read \App\Models\DrugStoreRelation|null $drugStoreRelation 门店售卖药品关系表[单]
|
|
* @property-read \App\Models\YiiModels\DrugstoreDrug|null $drugstoreDrug 门店药品关系(库存)
|
|
* @property-read string $created_at_format 创建时间的格式化
|
|
* @property-read string $status_string 状态名称
|
|
* @property-read string $updated_at_format 更新时间的格式化
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductOrderItem newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductOrderItem newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductOrderItem query()
|
|
* @mixin \Eloquent
|
|
*/
|
|
class ProductOrderItem extends BaseModel
|
|
{
|
|
/**
|
|
* @comment 药品
|
|
* @return BelongsTo
|
|
*/
|
|
public function drug(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Drug::class, 'drug_id');
|
|
}
|
|
|
|
/**
|
|
* @comment 门店售卖药品关系表[单]
|
|
* @return BelongsTo
|
|
*/
|
|
public function drugStoreRelation(): BelongsTo
|
|
{
|
|
return $this->belongsTo(DrugStoreRelation::class, 'drug_id', 'drug_id');
|
|
}
|
|
|
|
/**
|
|
* @comment 门店药品关系(库存)
|
|
* @return BelongsTo
|
|
*/
|
|
public function drugstoreDrug(): BelongsTo
|
|
{
|
|
return $this->belongsTo(DrugstoreDrug::class, 'drug_id', 'drug_id');
|
|
}
|
|
}
|