<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/10/30
 * Time: 10:32
 */
namespace App\Modules\BookGifts\Models;

use Illuminate\Database\Eloquent\Model;

class BookGiftsStatsByBook extends Model {
    protected $table = 'book_gifts_stats_bybook';
    protected $fillable = ['date','book_name','bid','gift_send_times','gift_send_user_num','gift_send_cost'];

    public static function getStats($start='',$end='') {
        $obj = self::orderBy('date','desc');
        if($start){
            $obj->where('date','>=',$start);
        }
        if($end){
            $obj->where('date','>=',$end);
        }
        return $obj->paginate();
    }
}