1

With CodeIgniter you can do something like this:

route['foo/(:any)'] = 'controller/$1';

This way, you create a pattern matching, using the last part of the URI as a function name for the controller.
So, 'foo/bar' will be routed to the controller 'controller' and the function executed will be 'bar'.

Question: can I do the same with Laravel 4? I've searched all over the place but couldn't find an answer. Tried to test it following CI's idea but had no success. Any help? Thanks!

Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188

1 Answers1

2

You can use RESTful controllers with this very simple syntax :

Route::controller('foo', 'FooController');

Then you will be able to use routes like that in FooController :

// GET /foo/clients/2
public function getClients($id)

// POST /foo/vip-clients
public function postVipClients()

Documentation : http://laravel.com/docs/controllers#restful-controllers

Alexandre Butynski
  • 6,625
  • 2
  • 31
  • 44