public function doesSlugExist($slug, $currentId = false) { $query = $this->book->where('slug', '=', $slug); if ($currentId) { $query = $query->where('id', '!=', $currentId); } return $query->count() > 0; }