public function getIndex($bookName = false, $chapter = false, $verse = false) { if ($bookName) { $bookId = Book::where('nev', $bookName)->first()->konyv_id; } else { $bookId = Input::get('book'); } if (!$chapter) { $chapter = Input::get('chapter'); if (!$chapter) { $chapter = 1; } } if (!$verse) { $verse = Input::get('verse'); } $words = $this->getChapterText($bookId, $chapter); $book = Book::findById($bookId); $books = Book::where('tipus', 'default')->orderBy('konyv_id')->get(); $bookLength = Book::getBookLength($book->nev); $chapterLength = Book::getChapterLength($book->nev, $chapter); return View::make("text.displayChapter", ["book" => $book, "chapter" => $chapter, "words" => $words, "verse" => $verse, 'books' => $books, 'currentBook' => $book->konyv_id, 'currentChapter' => $chapter, 'currentVerse' => $verse, 'currentBookLength' => $bookLength, 'currentChapterLength' => $chapterLength]); }
public function getChapterLength($bookId, $chapter) { $book = Book::findById($bookId); return Response::json(['bookLength' => Book::getBookLength($book->nev), 'chapterLength' => Book::getChapterLength($book->nev, $chapter)]); }