Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controller namespaces #80

Closed
woru opened this issue Apr 22, 2014 · 2 comments
Closed

controller namespaces #80

woru opened this issue Apr 22, 2014 · 2 comments
Assignees
Labels

Comments

@woru
Copy link
Member

woru commented Apr 22, 2014

Simple syntax (We can add more convenient syntax later):

Route::post('/api/users/:id/archive', 'api/users#archive');
Route::resource('api/users');
Route::get('/api/users/:id/orders', 'api/users#orders');

Resulting file structure:
application
/controller/api/UsersController.php
/view/api/Users/show.phtml
/view/api/Users/*.phtml

@woru woru added the feature label Apr 22, 2014
@woru
Copy link
Member Author

woru commented Apr 22, 2014

Route::group("api", function($route) {
    $route->post('/users/:id/archive', 'users#archive');
    $route->resource('users');
    $route->get('/users/:id/orders', 'users#orders');
});

or

Route::group("api", function($route) {
    Route::post('/users/:id/archive', 'users#archive');
    Route::resource('users');
    Route::get('/users/:id/orders', 'users#orders');
});

Should be an equivalent of:

Route::post('/api/users/:id/archive', 'api/users#archive');
Route::resource('api/users');
Route::get('/api/users/:id/orders', 'api/users#orders');

@bbankowski
Copy link
Member

My implementation works as follows:

Route::group("api", function() {
    GroupedRoute::post('/users/:id/archive', 'users#archive');
    GroupedRoute::resource('users');
    GroupedRoute::get('/users/:id/orders', 'users#orders');
});

Please, review the code. If you prefer what you proposed, it should be fairly easy to change. If you accept, then we should add issue on writing documentation.

@piotrooo piotrooo self-assigned this Dec 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants