September 2017
Intermediate to advanced
244 pages
6h 44m
English
Probably, you have noticed that in the preceding code example in our route file, we already mentioned the API version as v1. It is because API versioning is important and Dingo provides us the facility to do so. It is useful to serve different endpoints from different versions. You can have another version group and can serve the same endpoint with different content. If there is the same endpoint under different versions, then it will pick the version that is mentioned in your .env file.
However, it is better to have version in URI. To do so, we can simply use the following prefix:
$api->version('v1', ['prefix' => 'api/v1'], function ($api) { $api->resource('posts', "App\Http\Controllers\PostController"); $api->resource('comments', ...Read now
Unlock full access