Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
T
test-webshop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Artem
test-webshop
Commits
2d49f6f5
Commit
2d49f6f5
authored
May 14, 2020
by
Artem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pagination
parent
e3b436e7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
179 additions
and
2 deletions
+179
-2
ProductController.php
app/Http/Controllers/ProductController.php
+2
-1
DatabaseSeeder.php
database/seeds/DatabaseSeeder.php
+1
-1
bootstrap-4.blade.php
resources/views/vendor/pagination/bootstrap-4.blade.php
+46
-0
default.blade.php
resources/views/vendor/pagination/default.blade.php
+46
-0
semantic-ui.blade.php
resources/views/vendor/pagination/semantic-ui.blade.php
+36
-0
simple-bootstrap-4.blade.php
...rces/views/vendor/pagination/simple-bootstrap-4.blade.php
+27
-0
simple-default.blade.php
resources/views/vendor/pagination/simple-default.blade.php
+19
-0
welcome.blade.php
resources/views/welcome.blade.php
+2
-0
No files found.
app/Http/Controllers/ProductController.php
View file @
2d49f6f5
...
...
@@ -19,7 +19,8 @@ class ProductController extends Controller
public
function
index
()
{
// $products = DB::table('products')->get();
$products
=
Product
::
get
();
// $products = Product::get();
$products
=
Product
::
paginate
(
20
);
return
view
(
'welcome'
,
compact
(
'products'
));
}
...
...
database/seeds/DatabaseSeeder.php
View file @
2d49f6f5
...
...
@@ -12,6 +12,6 @@ class DatabaseSeeder extends Seeder
public
function
run
()
{
$this
->
call
(
UserSeeder
::
class
);
factory
(
App\Product
::
class
,
20
)
->
create
();
factory
(
App\Product
::
class
,
20
0
)
->
create
();
}
}
resources/views/vendor/pagination/bootstrap-4.blade.php
0 → 100644
View file @
2d49f6f5
@
if
(
$paginator
->
hasPages
())
<
nav
>
<
ul
class
="
pagination
justify
-
content
-
center
">
{{-- Previous Page Link --}}
@if (
$paginator->onFirstPage
())
<li class="
page
-
item
disabled
" aria-disabled="
true
" aria-label="
@
lang
(
'pagination.previous'
)
">
<span class="
page
-
link
" aria-hidden="
true
">‹</span>
</li>
@else
<li class="
page
-
item
">
<a class="
page
-
link
" href="
{{
$paginator
->
previousPageUrl
()
}}
" rel="
prev
" aria-label="
@
lang
(
'pagination.previous'
)
">‹</a>
</li>
@endif
{{-- Pagination Elements --}}
@foreach (
$elements
as
$element
)
{{-- "
Three
Dots
" Separator --}}
@if (is_string(
$element
))
<li class="
page
-
item
disabled
" aria-disabled="
true
"><span class="
page
-
link
">{{
$element
}}</span></li>
@endif
{{-- Array Of Links --}}
@if (is_array(
$element
))
@foreach (
$element
as
$page
=>
$url
)
@if (
$page
==
$paginator->currentPage
())
<li class="
page
-
item
active
" aria-current="
page
"><span class="
page
-
link
">{{
$page
}}</span></li>
@else
<li class="
page
-
item
"><a class="
page
-
link
" href="
{{
$url
}}
">{{
$page
}}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if (
$paginator->hasMorePages
())
<li class="
page
-
item
">
<a class="
page
-
link
" href="
{{
$paginator
->
nextPageUrl
()
}}
" rel="
next
" aria-label="
@
lang
(
'pagination.next'
)
">›</a>
</li>
@else
<li class="
page
-
item
disabled
" aria-disabled="
true
" aria-label="
@
lang
(
'pagination.next'
)
">
<span class="
page
-
link
" aria-hidden="
true
">›</span>
</li>
@endif
</ul>
</nav>
@endif
resources/views/vendor/pagination/default.blade.php
0 → 100644
View file @
2d49f6f5
@
if
(
$paginator
->
hasPages
())
<
nav
>
<
ul
class
="
pagination
">
{{-- Previous Page Link --}}
@if (
$paginator->onFirstPage
())
<li class="
disabled
" aria-disabled="
true
" aria-label="
@
lang
(
'pagination.previous'
)
">
<span aria-hidden="
true
">‹</span>
</li>
@else
<li>
<a href="
{{
$paginator
->
previousPageUrl
()
}}
" rel="
prev
" aria-label="
@
lang
(
'pagination.previous'
)
">‹</a>
</li>
@endif
{{-- Pagination Elements --}}
@foreach (
$elements
as
$element
)
{{-- "
Three
Dots
" Separator --}}
@if (is_string(
$element
))
<li class="
disabled
" aria-disabled="
true
"><span>{{
$element
}}</span></li>
@endif
{{-- Array Of Links --}}
@if (is_array(
$element
))
@foreach (
$element
as
$page
=>
$url
)
@if (
$page
==
$paginator->currentPage
())
<li class="
active
" aria-current="
page
"><span>{{
$page
}}</span></li>
@else
<li><a href="
{{
$url
}}
">{{
$page
}}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if (
$paginator->hasMorePages
())
<li>
<a href="
{{
$paginator
->
nextPageUrl
()
}}
" rel="
next
" aria-label="
@
lang
(
'pagination.next'
)
">›</a>
</li>
@else
<li class="
disabled
" aria-disabled="
true
" aria-label="
@
lang
(
'pagination.next'
)
">
<span aria-hidden="
true
">›</span>
</li>
@endif
</ul>
</nav>
@endif
resources/views/vendor/pagination/semantic-ui.blade.php
0 → 100644
View file @
2d49f6f5
@
if
(
$paginator
->
hasPages
())
<
div
class
="
ui
pagination
menu
" role="
navigation
">
{{-- Previous Page Link --}}
@if (
$paginator->onFirstPage
())
<a class="
icon
item
disabled
" aria-disabled="
true
" aria-label="
@
lang
(
'pagination.previous'
)
"> <i class="
left
chevron
icon
"></i> </a>
@else
<a class="
icon
item
" href="
{{
$paginator
->
previousPageUrl
()
}}
" rel="
prev
" aria-label="
@
lang
(
'pagination.previous'
)
"> <i class="
left
chevron
icon
"></i> </a>
@endif
{{-- Pagination Elements --}}
@foreach (
$elements
as
$element
)
{{-- "
Three
Dots
" Separator --}}
@if (is_string(
$element
))
<a class="
icon
item
disabled
" aria-disabled="
true
">{{
$element
}}</a>
@endif
{{-- Array Of Links --}}
@if (is_array(
$element
))
@foreach (
$element
as
$page
=>
$url
)
@if (
$page
==
$paginator->currentPage
())
<a class="
item
active
" href="
{{
$url
}}
" aria-current="
page
">{{
$page
}}</a>
@else
<a class="
item
" href="
{{
$url
}}
">{{
$page
}}</a>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if (
$paginator->hasMorePages
())
<a class="
icon
item
" href="
{{
$paginator
->
nextPageUrl
()
}}
" rel="
next
" aria-label="
@
lang
(
'pagination.next'
)
"> <i class="
right
chevron
icon
"></i> </a>
@else
<a class="
icon
item
disabled
" aria-disabled="
true
" aria-label="
@
lang
(
'pagination.next'
)
"> <i class="
right
chevron
icon
"></i> </a>
@endif
</div>
@endif
resources/views/vendor/pagination/simple-bootstrap-4.blade.php
0 → 100644
View file @
2d49f6f5
@
if
(
$paginator
->
hasPages
())
<
nav
>
<
ul
class
="
pagination
">
{{-- Previous Page Link --}}
@if (
$paginator->onFirstPage
())
<li class="
page
-
item
disabled
" aria-disabled="
true
">
<span class="
page
-
link
">@lang('pagination.previous')</span>
</li>
@else
<li class="
page
-
item
">
<a class="
page
-
link
" href="
{{
$paginator
->
previousPageUrl
()
}}
" rel="
prev
">@lang('pagination.previous')</a>
</li>
@endif
{{-- Next Page Link --}}
@if (
$paginator->hasMorePages
())
<li class="
page
-
item
">
<a class="
page
-
link
" href="
{{
$paginator
->
nextPageUrl
()
}}
" rel="
next
">@lang('pagination.next')</a>
</li>
@else
<li class="
page
-
item
disabled
" aria-disabled="
true
">
<span class="
page
-
link
">@lang('pagination.next')</span>
</li>
@endif
</ul>
</nav>
@endif
resources/views/vendor/pagination/simple-default.blade.php
0 → 100644
View file @
2d49f6f5
@
if
(
$paginator
->
hasPages
())
<
nav
>
<
ul
class
="
pagination
">
{{-- Previous Page Link --}}
@if (
$paginator->onFirstPage
())
<li class="
disabled
" aria-disabled="
true
"><span>@lang('pagination.previous')</span></li>
@else
<li><a href="
{{
$paginator
->
previousPageUrl
()
}}
" rel="
prev
">@lang('pagination.previous')</a></li>
@endif
{{-- Next Page Link --}}
@if (
$paginator->hasMorePages
())
<li><a href="
{{
$paginator
->
nextPageUrl
()
}}
" rel="
next
">@lang('pagination.next')</a></li>
@else
<li class="
disabled
" aria-disabled="
true
"><span>@lang('pagination.next')</span></li>
@endif
</ul>
</nav>
@endif
resources/views/welcome.blade.php
View file @
2d49f6f5
...
...
@@ -27,6 +27,8 @@
</li>
@endforeach
</ul>
{{
$products->links
() }}
</div>
</section>
@endsection
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment