Last active
August 29, 2015 14:15
-
-
Save MrAtiebatie/0e31af54e8ad461caa50 to your computer and use it in GitHub Desktop.
Laravel Nested RESTful Controllers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is an example code for how to use nested RESTful controllers | |
* in Laravel 4 & 5. Yes, in this case you could you use a resource | |
* controller but sometimes you don't have the same method names | |
* as a resource controller. The method names in this example weren't | |
* my case so it's just some example code. | |
* | |
* You can also use static function calls instead of OOP way. | |
*/ | |
$router->group(array('prefix' => 'users/{id}'), function() use ($router) { | |
// Images controller | |
$router->controller('images', 'ImagesController', [ | |
'getIndex' => 'user.images.index', | |
'getShow' => 'user.images.show' | |
]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment