| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Models;
- /**
- * 订单管理-模型
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Models
- */
- class OrderModel extends BaseModel
- {
- // 设置数据表
- protected $table = 'orders';
- /**
- * 接单人员
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function user()
- {
- return $this->hasOne(MemberModel::class, 'id','user_id')
- ->select(['id','mobile','nickname','realname','balance','picker_order_num','picker_status','confirm_status','status']);
- }
- /**
- * 经手人
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function adminUser()
- {
- return $this->hasOne(UserModel::class, 'id','confirm_admin_id')
- ->select(['id','nickname','mobile','realname','status']);
- }
- /**
- * 已审核
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function confirm()
- {
- return $this->hasOne(OrderModel::class, 'goods_id','goods_id')
- ->with(['user'])
- ->whereIn('status',[2,3])
- ->where(['mark'=>1])
- ->select(['id','order_no','goods_id','confirm_at','status']);
- }
- /**
- * 订单商品
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function goods()
- {
- return $this->hasOne(GoodsModel::class, 'id','goods_id')->with(['shipperCity','shipperDistrict','receiverCity','receiverDistrict']);
- }
- }
|