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
Post a Comment