| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?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 GoodsCommentModel extends BaseModel
- {
- // 设置数据表
- protected $table = 'goods_comments';
- protected $appends = ['time_text'];
- // 时间
- public function getTimeTextAttribute()
- {
- return $this->create_time? datetime($this->create_time,'Y-m-d H:i:s') : '';
- }
- /**
- * 发布用户
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function user()
- {
- return $this->hasOne(MemberModel::class, 'id', 'user_id')
- ->select(['id','openid', 'mobile', 'nickname','balance', 'realname', 'status']);
- }
- /**
- * 订单
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function order()
- {
- return $this->hasOne(OrderModel::class, 'id', 'order_id')
- ->select(['id','order_no', 'user_id', 'total','status']);
- }
- }
|