VerifyCode.php 355 B

123456789101112131415161718
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * 注册时的激活验证码
  6. */
  7. class VerifyCode extends Model
  8. {
  9. protected $table = 'verify_code';
  10. public function scopeRecentUnused($query)
  11. {
  12. return $query->whereStatus(0)->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-15 minutes')));
  13. }
  14. }