php - Laravel: using url parameter for controller action -


sorry i'm laravel newbie - here's route code:

route::get('shop/{id}', function($id) { }); 

$id represents shop category id , pass id controller-action shop\startcontroller@showarticles

i'm used syntax:

route::get('/', 'shop\startcontroller@show'); 

how that? thanks

just pass parameter (assuming laravel 5.1 used):

controller:

class startcontroller extends controller .... public function show($id) {    //add controller logic } 

routes:

//asuming namespace `shop` loaded route::get('/', 'startcontroller@show'); 

check out more here


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -