<?php namespace App\Modules\BadInfo\Models; use Illuminate\Database\Eloquent\Model; class BookSensitiveStat extends Model { protected $table = 'book_sensitive_stats'; protected $fillable = ['bid', 'num', 'time']; public static function getCurrentObj() { $max_time = self::getMaxTime(); return self::where('time',$max_time); } public static function getMaxTime() { $last_record = self::orderBy('id','desc')->first(); return $last_record ? $last_record->time : 0; } }