VerifyCode.php 384 B

12345678910111213141516171819
  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. protected $guarded = [];
  11. public function scopeRecentUnused($query)
  12. {
  13. return $query->whereStatus(0)->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-15 minutes')));
  14. }
  15. }