Reputation: 919
I'm trying to implement a RESTful API using Laravel restful controllers ($restful = true in the controller). The problem is that I'd like to retrieve a single record by using /customer/123 instead of /customer/index/123 and I can't find a way to do this without implementing every route in route.php file.
Is there a way to map all /(model)/(id) to the appropriate controller and action ? (without doing one by one).
I'm using Route::controller() in the route.php file.
Upvotes: 0
Views: 476
Reputation: 6511
Like Jason said, wait until L4 (may 28) or grab the beta from http://four.laravel.com and use the resourcecontrollers.
It is true that you must define every route, but I got some ideas for you:
In that way you can either use the L4 resourcecontroller or create a custom controller/route combo like your example.
Upvotes: 1
Reputation: 2596
This is not possible, you have to route every controller. The automatic routing is instable and thus it is removed in laravel 4.
Upvotes: 0