This does not show second page and next to last page. And has two on each side.
https://imgur.com/zwNEDlz

Template custompager.blade.php:
@if ($paginator->hasPages())
<ul class="pagination pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="disabled"><span>«</span></li>
@else
<li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">«</a></li>
@endif
@if($paginator->currentPage() > 3)
<li class="hidden-xs"><a href="{{ $paginator->url(1) }}">1</a></li>
@endif
@if($paginator->currentPage() > 4)
<li><span>...</span></li>
@endif
@foreach(range(1, $paginator->lastPage()) as $i)
@if($i >= $paginator->currentPage() - 2 && $i <= $paginator->currentPage() + 2)
@if ($i == $paginator->currentPage())
<li class="active"><span>{{ $i }}</span></li>
@else
<li><a href="{{ $paginator->url($i) }}">{{ $i }}</a></li>
@endif
@endif
@endforeach
@if($paginator->currentPage() < $paginator->lastPage() - 3)
<li><span>...</span></li>
@endif
@if($paginator->currentPage() < $paginator->lastPage() - 2)
<li class="hidden-xs"><a href="{{ $paginator->url($paginator->lastPage()) }}">{{ $paginator->lastPage() }}</a></li>
@endif
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li><a href="{{ $paginator->nextPageUrl() }}" rel="next">»</a></li>
@else
<li class="disabled"><span>»</span></li>
@endif
</ul>
@endif
Even though the docs explain usage of a custom template, I'll show simple usage here:
As example, say I have made a folder under views called cpag, and named the custom template custom:
views/cpag/custom.blade.php
Then in the view where used,
{{ $dogs->links('cpag.custom') }}
of course if you have appends then:
{{ $dogs->appends($append_array)->links('cpag.custom') }}
And as be seen from the following image, you can write custom templates anyway you need.
In case you can't see image: https://i.imgur.com/qQsiLNN.jpg
Reference:
https://laravel.com/docs/5.8/pagination#customizing-the-pagination-view
from
https://laravel.com/docs/5.8/pagination
Of course also read https://laravel.com/docs/5.8/pagination#customizing-the-pagination-view