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

namespace App\Modules\MediaPush\Models;

use Illuminate\Database\Eloquent\Model;

class MediaPushRelationBooks extends Model
{
    protected $table = 'media_push_book_relations';
    protected $fillable = ['id', 'pro_bids', 'bid', 'created_at', 'updated_at'];

    static function getByBid($bid)
    {
        return self::where('bid', $bid)->first();
    }

    static function updateItem($bid, $params = [])
    {
        return self::where('bid', $bid)->update($params);
    }

    static function addItem($data)
    {
        return self::create($data);
    }

    static function createdOrUpdated($insertArray, $updateArray)
    {
        return self::updateOrInsert($insertArray, $updateArray);
    }
}