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!

Was it helpful?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top