<?php

namespace App\Modules\Book\Models;

use Illuminate\Database\Eloquent\Model;

class BookRoles extends Model
{
    protected $table = 'book_roles';
    protected $fillable = ['bid','role'];

    public static function getRolesByBid($bid) {
        return self::where('bid',$bid)->get();
    }

    public static function getBidsByRole($role) {
        return self::where('role',$role)->select('bid')->get()->pluck('bid')->all();
    }
    public static function  getById($id){
        return self::where('id',$id)->first();
    }
}
