| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace App\Models;
- use App\Models\BaseModel;
- use Illuminate\Database\Eloquent\SoftDeletes;
- /**
- * @description 订单列表
- * @author system;
- * @version 1.0
- * @date 2018-07-12 08:32:14
- *
- */
- class OrderInfoModel extends BaseModel
- {
- use SoftDeletes;
- /**
- * 数据表名
- *
- * @var string
- *
- */
- protected $table = 'order_info';
- /**
- * 主键
- */
- protected $primaryKey = 'id';
- //分页
- protected $perPage = PAGE_NUMS;
- /**
- * 可以被集体附值的表的字段
- *
- * @var string
- */
- protected $fillable = [
- 'out_trade_no',
- 'username',
- 'sex',
- 'phone',
- 'email',
- 'store_id',
- 'schedule_time',
- 'status',
- 'user_id',
- 'comment',
- 'product_id',
- 'schedule_id',
- 'price',
- 'deposit',
- 'paytype'
- ];
- public function store()
- {
- return (new StoreInfoModel())->find($this->store_id) ? (new StoreInfoModel())->find($this->store_id)->name : $this->store_id;
- }
- public function getstore()
- {
- return $this->belongsTo('App\Models\StoreInfoModel', 'store_id');
- }
- public function product()
- {
- return $this->belongsTo('App\Models\ProductInfoModel', 'product_id');
- }
- public function status()
- {
- switch ($this->status) {
- case 1:
- return '已付款';
- break;
- case 2:
- return '已完成';
- break;
- case 3:
- return '已取消';
- break;
- default:
- return '未付款';
- break;
- }
- }
- public function paidinfo()
- {
- return $this->hasOne('App\Models\PaidInfoModel', 'order_id');
- }
- public function refundinfo()
- {
- return $this->hasOne('App\Models\RefundInfoModel', 'order_id');
- }
- }
|