Reputation: 333
I have Dingo API.
This is my routes.php file:
Route::resource('test','TestController');
$api = app('api.router');
$api->version('v1',['prefix' => 'api'], function ($api) {
$api->resource('user', 'App\Http\Controllers\API\v1\UserController');
});
In UserController I can only use API routes??
So I cannot do route('test.index') as it gives me this error: Route [test.index] not defined
but route('api.user.index') works fine?
How can I use native Laravel routes like test.index, test.edit etc?
I see route() calling app() function, but I don't get how it works. Is this documented anywhere?
Upvotes: 0
Views: 2145
Reputation: 1
public function index() {
$products = Product::latest()->paginate(5);
return view('products.index',compact('products'))
->with('i', (request()->input('page', 1) - 1) * 5);
}
Upvotes: -1
Reputation: 333
I figured it out... The issue was discussed here: https://github.com/dingo/api/issues/918
A pull request was submitted by jenky https://github.com/dingo/api/pull/919
I simply ran "composer update" to get latest dev version of Dingo API and the issue was solved.
Upvotes: 0