| Conditions | 3 | 
| Paths | 1 | 
| Total Lines | 13 | 
| Code Lines | 7 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 40 | protected function lastPage(): Attribute | ||
| 41 |     { | ||
| 42 | return Attribute::make( | ||
| 43 |             get: function () { | ||
| 44 | $posts = $this->post_count_formated; | ||
| 45 | |||
| 46 |                 if ($this->is_solved) { | ||
| 47 | $posts = $posts - 1; | ||
| 48 | } | ||
| 49 | |||
| 50 |                 $page = (int) ceil($posts / config('xetaravel.pagination.discuss.post_per_page')); | ||
| 51 | |||
| 52 | return $page ?: 1; | ||
| 53 | } | ||
| 57 |