<?php

namespace App\Modules\Book\Models;

use Illuminate\Database\Eloquent\Model;

class BadBookInfo extends Model
{
    protected $table = 'bad_book_info';
    protected $fillable = ['id', 'badInfo', 'updated_at', 'created_at'];

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

    static function editBadInfo($data)
    {
        return self::where('id',$data['id'])->update(['badInfo'=>$data['badInfo']]);
    }

    static function getBadInfo($isAll)
    {
        $search_object = self::orderBy('created_at', 'desc');
        if ($isAll) {
            return $search_object->get();
        } else {
            return $search_object->paginate();
        }
    }
}
