$chapterSelect=$this->db->table('chapters')->selectRaw("'BookStack\\\\Chapter' as entity_type, id, slug, name, '' as text, description, book_id, priority, 0 as chapter_id, 0 as draft")->where('book_id','=',$book_id);
$whereQuery=$this->db->table('joint_permissions as jp')->selectRaw('COUNT(*)')