Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
onestartup-product-primer_plano
Overview
Overview
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
Francisco Salazar
onestartup-product-primer_plano
Commits
4ec49b28
Commit
4ec49b28
authored
Nov 23, 2018
by
Francisco Salazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
product order desc
parent
8fe2e5d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
ProductController.php
src/controllers/ProductController.php
+4
-4
list.blade.php
src/views/public/list.blade.php
+3
-1
No files found.
src/controllers/ProductController.php
View file @
4ec49b28
...
...
@@ -17,10 +17,10 @@ class ProductController extends Controller
if
(
isset
(
$request
->
category
)){
$category
=
Category
::
where
(
'slug'
,
$request
->
category
)
->
first
();
$products
=
$category
->
products
()
->
where
(
'active'
,
true
)
->
paginate
(
config
(
"product.product-index."
));
$products
=
$category
->
products
()
->
where
(
'active'
,
true
)
->
orderBy
(
'created_at'
,
'desc'
)
->
paginate
(
config
(
"product.product-index."
));
}
else
{
$products
=
Product
::
where
(
'active'
,
true
)
->
paginate
(
config
(
"product.product-index.pagination"
));
$products
=
Product
::
where
(
'active'
,
true
)
->
orderBy
(
'created_at'
,
'desc'
)
->
paginate
(
config
(
"product.product-index.pagination"
));
}
$otros
=
Product
::
where
(
'active'
,
true
)
->
inRandomOrder
()
->
take
(
config
(
"product.product-index.otros"
))
->
get
();
$categories
=
Category
::
where
(
'active'
,
true
)
->
get
();
...
...
@@ -58,7 +58,7 @@ class ProductController extends Controller
public
function
byCategory
(
$category_slug
)
{
$category
=
Category
::
where
(
'slug'
,
$category_slug
)
->
first
();
$products
=
$category
->
products
()
->
where
(
'active'
,
true
)
->
paginate
(
config
(
"product.product-bycategory.pagination"
));
$products
=
$category
->
products
()
->
where
(
'active'
,
true
)
->
orderBy
(
'created_at'
,
'desc'
)
->
paginate
(
config
(
"product.product-bycategory.pagination"
));
$otros
=
Product
::
where
(
'active'
,
true
)
->
inRandomOrder
()
->
take
(
config
(
"product.product-bycategory.otros"
))
->
get
();
$categories
=
Category
::
where
(
'active'
,
true
)
->
get
();
...
...
@@ -75,7 +75,7 @@ class ProductController extends Controller
//return $category_slug . " " .$subcategory_slug;
$category
=
Category
::
where
(
'slug'
,
$category_slug
)
->
first
();
$subcategory
=
$category
->
subcategories
->
where
(
'slug'
,
$subcategory_slug
)
->
first
();
$products
=
$subcategory
->
products
()
->
where
(
'active'
,
true
)
->
paginate
(
config
(
"product.product-bysubcategory.pagination"
));
$products
=
$subcategory
->
products
()
->
where
(
'active'
,
true
)
->
orderBy
(
'created_at'
,
'desc'
)
->
paginate
(
config
(
"product.product-bysubcategory.pagination"
));
$otros
=
Product
::
where
(
'active'
,
true
)
->
inRandomOrder
()
->
take
(
config
(
"product.product-bycategory.otros"
))
->
get
();
$categories
=
Category
::
where
(
'active'
,
true
)
->
get
();
...
...
src/views/public/list.blade.php
View file @
4ec49b28
...
...
@@ -10,7 +10,9 @@ Listado de entradas
<
p
>
Productos
todas
{{
$products
}}
@
foreach
(
$products
as
$product
)
{{
$product
}}
@
endforeach
</
p
>
<
p
>
...
...
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