Question

I was hoping someone could shed some light for me on how to nest my resources within /api/ routes.

For example:

Route::resource('sale', 'SaleController');

Would be accessed with E.G: http://something.dev/api/sales

Any advice on this would be much appreciated thanks!

Était-ce utile?

La solution

You can wrap these in a route group with a prefix, like this:

Route::group(
    array('prefix' => 'api'),
    function()
    {
        Route::resource('sale', 'SaleController');
    }
);

See the docs for more info: http://laravel.com/docs/routing#route-prefixing

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top