Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
onestartup-shop
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
Angel Martin
onestartup-shop
Commits
93d8203d
Commit
93d8203d
authored
Sep 19, 2018
by
Francisco Salazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return category, relations products-tags
parent
5077bbab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
ProductController.php
src/controllers/ProductController.php
+3
-2
ProductTag.php
src/models/ProductTag.php
+1
-1
No files found.
src/controllers/ProductController.php
View file @
93d8203d
...
...
@@ -36,8 +36,6 @@ class ProductController extends Controller
$product
=
Product
::
where
(
'slug'
,
$slug
)
->
first
();
$otros
=
$product
->
category
->
products
()
->
where
(
'active'
,
true
)
->
inRandomOrder
()
->
take
(
config
(
"shop.product-show.otros"
))
->
get
();
$categories
=
Category
::
all
();
if
(
$product
!=
null
)
{
...
...
@@ -48,6 +46,8 @@ class ProductController extends Controller
return
redirect
(
'no_existe'
);
}
$otros
=
$product
->
category
->
products
()
->
where
(
'active'
,
true
)
->
where
(
'id'
,
'<>'
,
$product
->
id
)
->
inRandomOrder
()
->
take
(
config
(
"shop.product-show.otros"
))
->
get
();
return
view
(
'shop-public::single'
)
->
with
(
'product'
,
$product
)
->
with
(
'categories'
,
$categories
)
...
...
@@ -67,6 +67,7 @@ class ProductController extends Controller
$categories
=
Category
::
where
(
'active'
,
true
)
->
get
();
return
view
(
'shop-public::list'
)
->
with
(
'category'
,
$category
)
->
with
(
'categories'
,
$categories
)
->
with
(
'otros'
,
$otros
)
->
with
(
'products'
,
$products
);
...
...
src/models/ProductTag.php
View file @
93d8203d
...
...
@@ -9,7 +9,7 @@ class ProductTag extends Model
protected
$table
=
'product_tags'
;
protected
$fillable
=
[
"description"
];
public
function
tag
s
(){
public
function
product
s
(){
return
$this
->
belongsToMany
(
'Onestartup\Shop\Model\ProductShop'
,
'product_product_tags'
,
'tag_id'
,
'product_id'
);
}
}
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