AppearanceVoteModel.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Models\Appearance;
  3. use App\Models\User\UserModel;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * App\Models\Appearance\AppearanceVoteModel
  7. *
  8. * @property int $id
  9. * @property \Illuminate\Support\Carbon $created_at 创建时间
  10. * @property \Illuminate\Support\Carbon $updated_at 更新时间
  11. * @property int $uid 用户
  12. * @property int $type 类型:1=学校
  13. * 2=用户
  14. * @property int $partner_id 卡片
  15. * @property string $school 学校
  16. * @property string $media_id 公众号
  17. * @property-read \App\Models\User\UserModel $user
  18. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel newModelQuery()
  19. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel newQuery()
  20. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel query()
  21. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel today()
  22. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel whereCreatedAt($value)
  23. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel whereId($value)
  24. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel whereMediaId($value)
  25. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel wherePartnerId($value)
  26. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel whereSchool($value)
  27. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel whereType($value)
  28. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel whereUid($value)
  29. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Appearance\AppearanceVoteModel whereUpdatedAt($value)
  30. * @mixin \Eloquent
  31. */
  32. class AppearanceVoteModel extends Model
  33. {
  34. //
  35. protected $table = 'fpdx_appearance_votes';
  36. protected $dateFormat = 'U';
  37. protected $fillable = ['uid', 'type', 'partner_id', 'school', 'media_id'];
  38. public function scopeToday($query)
  39. {
  40. return $query->whereBetween('created_at', [mktime(0, 0, 0), mktime(23, 59, 59)]);
  41. }
  42. public function user()
  43. {
  44. return $this->belongsTo(UserModel::class, 'uid', 'uid')->select('nickname', 'headimgurl', 'sex');
  45. }
  46. }