123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- namespace App\Models;
- use App\Models\BaseModel;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Laravel\Passport\HasApiTokens;
- use Illuminate\Notifications\Notifiable;
- /**
- * @description 用户表
- * @author system;
- * @version 1.0
- * @date 2017-05-30 12:16:56
- *
- */
- class UserInfoModel extends Authenticatable
- {
- use HasApiTokens, Notifiable;
- /**
- * 数据表名
- *
- * @var string
- *
- */
- protected $table = 'user_info';
- /**
- 主键
- */
- protected $primaryKey = 'id';
- //分页
- protected $perPage = PAGE_NUMS;
- /**
- * 可以被集体附值的表的字段
- *
- * @var string
- */
- protected $fillable = [
- 'tel',
- 'password',
- 'nickname',
- 'sign',
- 'pic',
- 'money',
- 'sex',
- 'signture',
- 'tall',
- 'job',
- 'emotion',
- 'address',
- 'detail_address',
- 'status',
- 'remember_token',
- ];
- protected $hidden = ['password'];
- public function UserCareUser()
- {
- return $this->belongsToMany('App\Models\UserInfoModel','user_care_user','user_id','other_user_id');
- }
- // 系统消息
- public function systemInfo()
- {
- return $this->belongsToMany('App\Models\UserInfoModel','system_info','other_id','user_id')->withPivot('coin');
- }
- //用户梦想
- public function UserDream()
- {
- return $this->belongsToMany('App\Models\DreamInfoModel','user_dream','user_id','dream_id');
- }
- //支持的梦想
- public function supDream()
- {
- return $this->belongsToMany('App\Models\DreamInfoModel','system_info','user_id','other_id');
- }
- //评论的梦想
- public function comDream()
- {
- return $this->belongsToMany('App\Models\DreamInfoModel','comments_info','user_id','dream_id')->withPivot('content', 'level','created_at');
- }
- //关注的用户
- public function myCareNum()
- {
- return $this->hasMany('App\Models\UserCareUser','user_id','id');
- }
- //关注我的用户
- public function myFens()
- {
- return $this->hasMany('App\Models\UserCareUser','other_user_id','id');
- }
- // 我的收藏
- public function myCollection()
- {
- return $this->hasMany('App\Models\UserCareDream','user_id','id');
- }
- // 回复的梦想
- public function replyDream()
- {
- return $this->belongsToMany('App\Models\CommentInfoModel','reply_comments_info','user_id','comment_id')->withPivot('content', 'level','created_at');
- }
- }
|