Verify.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Builder;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * 注册时的验证激活地址
  7. *
  8. * @property int $id
  9. * @property int $type 激活类型:1-自行激活、2-管理员激活
  10. * @property int $user_id 用户ID
  11. * @property string $token 校验token
  12. * @property int $status 状态:0-未使用、1-已使用、2-已失效
  13. * @property \Illuminate\Support\Carbon|null $created_at 创建时间
  14. * @property \Illuminate\Support\Carbon|null $updated_at 最后更新时间
  15. * @property-read \App\Models\User|null $user
  16. * @method static Builder|Verify newModelQuery()
  17. * @method static Builder|Verify newQuery()
  18. * @method static Builder|Verify query()
  19. * @method static Builder|Verify type($type)
  20. * @method static Builder|Verify whereCreatedAt($value)
  21. * @method static Builder|Verify whereId($value)
  22. * @method static Builder|Verify whereStatus($value)
  23. * @method static Builder|Verify whereToken($value)
  24. * @method static Builder|Verify whereType($value)
  25. * @method static Builder|Verify whereUpdatedAt($value)
  26. * @method static Builder|Verify whereUserId($value)
  27. * @mixin \Eloquent
  28. */
  29. class Verify extends Model {
  30. protected $table = 'verify';
  31. protected $primaryKey = 'id';
  32. // 筛选类型
  33. function scopeType($query, $type) {
  34. return $query->whereType($type);
  35. }
  36. function user() {
  37. return $this->hasOne(User::class, 'id', 'user_id');
  38. }
  39. }