Verify.php 1.5 KB

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