BookSensitiveStat.php 537 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Modules\BadInfo\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class BookSensitiveStat extends Model
  5. {
  6. protected $table = 'book_sensitive_stats';
  7. protected $fillable = ['bid', 'num', 'time'];
  8. public static function getCurrentObj()
  9. {
  10. $max_time = self::getMaxTime();
  11. return self::where('time',$max_time);
  12. }
  13. public static function getMaxTime()
  14. {
  15. $last_record = self::orderBy('id','desc')->first();
  16. return $last_record ? $last_record->time : 0;
  17. }
  18. }