Verify.php 1.5 KB

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