<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2017/11/21
 * Time: 8:59
 */

namespace App\Modules\MediaPush\Models;

use Illuminate\Database\Eloquent\Model;

class MediaPushCovers extends Model
{
    protected $table = 'media_push_covers';
    protected $fillable = ['id', 'url', 'bid', 'created_at', 'updated_at'];

    /**
     * 获取信息
     * @param array $params
     * @return mixed
     */
    public static function getCovers($params=[])
    {
        $search_object = self::orderBy('updated_at', 'asc');
        if (isset($params['bid']) && $params['bid']) $search_object->where('bid', $params['bid']);
        return $search_object->paginate();
    }

    /**
     * 添加信息
     */
    static function addItem($data)
    {
        return self::create($data);
    }
}