【问题标题】:how to get view from api response on laravel 5.4 or 5.5如何从 laravel 5.4 或 5.5 上的 api 响应中获取视图
【发布时间】:2017-09-18 14:15:54
【问题描述】:

示例

类 ProductController 扩展控制器 { 公共功能展示($id) { 返回新的 ProductResource(Product::find($id)); } }

Route::get('/products/{id}', 'ProductController@show');

现在我如何获得路线产品/id

【问题讨论】:

    标签: laravel-5.4


    【解决方案1】:

    在这种情况下你需要添加一些要求:

    在 api.php 路由上添加这一行

    路线:

    Route::get('api/products/{id}', 'ProductController@show');
    

    通过邮递员 |卷曲:http://example.com/api/products/1

    【讨论】:

      猜你喜欢
      • 2018-02-16
      • 2019-04-25
      • 1970-01-01
      • 1970-01-01
      • 2020-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多