문제

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!

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top