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
c264bcf6
Commit
c264bcf6
authored
Jun 14, 2018
by
Angel MAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
categorias con sus urls
parent
077f60f2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
3 deletions
+30
-3
ProductController.php
src/controllers/ProductController.php
+18
-0
routes.php
src/routes.php
+7
-3
list.blade.php
src/views/public/list.blade.php
+5
-0
No files found.
src/controllers/ProductController.php
View file @
c264bcf6
...
...
@@ -57,4 +57,22 @@ class ProductController extends Controller
}
public
function
shoByCategory
(
$slug
)
{
$category
=
Category
::
where
(
'active'
,
true
)
->
where
(
'slug'
,
$slug
)
->
first
();
$products
=
$category
->
products
()
->
where
(
'active'
,
true
)
->
paginate
(
15
);
$otros
=
Product
::
where
(
'active'
,
true
)
->
inRandomOrder
()
->
take
(
15
)
->
get
();
$categories
=
Category
::
where
(
'active'
,
true
)
->
get
();
return
view
(
'shop-public::list'
)
->
with
(
'categories'
,
$categories
)
->
with
(
'otros'
,
$otros
)
->
with
(
'products'
,
$products
);
}
}
src/routes.php
View file @
c264bcf6
...
...
@@ -99,9 +99,13 @@ Route::group(['middleware' => ['web']], function(){
->
name
(
'cart.update'
);
Route
::
get
(
'producto/{slug}'
,
'Onestartup\Shop\Controller\ProductController@show'
)
->
name
(
'show.shop'
);
Route
::
get
(
'shop'
,
'Onestartup\Shop\Controller\ProductController@index'
)
->
name
(
'main.shop'
);
//Route::get('cart/{product_id}')
Route
::
get
(
env
(
'SLUG_SHOP'
)
.
'/{slug}'
,
'Onestartup\Shop\Controller\ProductController@show'
)
->
name
(
'show.shop'
);
Route
::
get
(
env
(
'SLUG_SHOP'
),
'Onestartup\Shop\Controller\ProductController@index'
)
->
name
(
'main.shop'
);
Route
::
get
(
env
(
'SLUG_SHOP'
)
.
'/'
.
env
(
'SLUG_SHOP_CATEGORY'
)
.
'/{slug_category}'
,
'Onestartup\Shop\Controller\ProductController@shoByCategory'
)
->
name
(
'category.shop'
);
Route
::
post
(
'cart/paymentPaypal'
,
'Onestartup\Shop\Controller\CartController@paymentPaypal'
)
->
name
(
'cart.paymentPaypal'
);
Route
::
get
(
'cart/successPaypal'
,
'Onestartup\Shop\Controller\CartController@successPaypal'
)
->
name
(
'cart.successPaypal'
);
...
...
src/views/public/list.blade.php
View file @
c264bcf6
...
...
@@ -27,9 +27,13 @@
<
a
href
=
"{{route('show.shop',
$product->slug
)}}"
>
Ver
mas
informacion
</
a
>
</
p
>
</
div
>
<
div
>
<
a
href
=
"{{route('category.shop',
$product->category
->slug)}}"
>
Enlace
categoria
</
a
>
</
div
>
</
div
>
@
endforeach
</
div
>
@
endsection
\ No newline at end of file
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