Domanda

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!

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top