protected function getPaginatedIfNeeded(NotifynderCollection $notifications, $perPage, $paginate)
{
if (!$this->isPaginated($paginate)) {
return $notifications->parse();
} elseif ($paginate === true) {
$paginate = null;
}
$page = LengthAwarePaginator::resolveCurrentPage();
$total = $notifications->count();
$notifications = $notifications->forPage($page, $perPage);
return new LengthAwarePaginator($notifications->parse(), $total, $perPage, $paginate, ['path' => LengthAwarePaginator::resolveCurrentPath()]);
}