| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?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 ActivitySignModel extends BaseModel
- {
- // 设置数据表
- protected $table = 'activitys_signs';
- protected $appends = ['time_text'];
- // 时间
- public function getTimeTextAttribute()
- {
- return $this->create_time? datetime($this->create_time,'Y-m-d H:i:s') : '';
- }
- /**
- * 签到用户
- */
- public function member()
- {
- return $this->hasOne(MemberModel::class, 'id','user_id')
- ->where(['mark'=>1])
- ->select(['id', 'nickname','avatar', 'realname','mobile','gender', 'status']);
- }
- /**
- * 活动
- */
- public function activity()
- {
- return $this->hasOne(ActivityModel::class, 'id','activity_id')
- ->where(['mark'=>1])
- ->select(['id', 'title','thumb', 'type', 'status']);
- }
- }
|