PaliTextService.php 505 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App\Services;
  3. use App\Models\PaliText;
  4. class PaliTextService
  5. {
  6. public function getParent(int $book, int $para) {}
  7. public function getCurrChapter(int $book, int $para)
  8. {
  9. $paragraph = PaliText::where('book', $book)
  10. ->where('paragraph', '<=', $para)
  11. ->where('level', '<', 8)
  12. ->orderBy('paragraph', 'desc')->first();
  13. if ($paragraph) {
  14. return $paragraph;
  15. } else {
  16. return null;
  17. }
  18. }
  19. }