oBo
oBo

Reputation: 992

Laravel 4 Routing - Is it possible to name a controller in route group?

Im pretty sure this is not possible but I would like to know ifs there is some way to name a controller in a Route::group();

And then specify the function names in the route::group().

Example:

Route::group(['uses'=>'HomeController'], function(){
    Route::get('/', ['function'=>'getIndex']);
    Route::post('/', ['function'=>'postIndex']);
    Route::put('/', ['function'=>'putIndex']);
});

Any ideas?

Upvotes: 0

Views: 175

Answers (1)

Jason Lewis
Jason Lewis

Reputation: 18665

From the code you've provided all it seems like you want to do is use Route::controller().

Route::controller('/', 'HomeController');

Then just make sure that you name your methods getIndex, postIndex, putIndex, and so on and so forth.

Upvotes: 1

Related Questions