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

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

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -