dingo-api 不能做路由模型绑定么?
问题最初是在我的项目中使用路由模型绑定的时候,需要使用到User模型,但是能获取到模型却始终获取不到模型数据。后来我又下载了个干净的5.5版本但是不能支持路由模型绑定?我想知道dingo/api是否支持?
下面是我的代码
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
/*Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});*/
$api = app('Dingo\Api\Routing\Router');
$api->version('v1',function($api) {
$api->get('/users/{user}',function(\App\User $user){
return $user;
});
});
1 Comment
@lanlongyu#1323 5.5支持路由模型绑定的啊