Arrays 在laravel中打印出集合的值

Arrays 在laravel中打印出集合的值,arrays,debugging,laravel-5,collections,Arrays,Debugging,Laravel 5,Collections,我的控制器里有 $all = \App\Product::where('campaign_id', $product->campaign_id)->get(); 当我在模板中添加时 {{ dd($all)}} 我得到一个收集对象 Collection {#340 ▼ #items: array:1 [▼ 0 => Product {#341 ▼ #connection: "mysql" #table: null #primar

我的控制器里有

$all = \App\Product::where('campaign_id', $product->campaign_id)->get();
当我在模板中添加时

{{ dd($all)}}
我得到一个收集对象

Collection {#340 ▼
  #items: array:1 [▼
    0 => Product {#341 ▼
      #connection: "mysql"
      #table: null
      #primaryKey: "id"
      #keyType: "int"
      +incrementing: true
      #with: []
      #withCount: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:10 [▶]
      #original: array:10 [▶]
      #casts: []
      #dates: []
      #dateFormat: null
      #appends: []
      #events: []
      #observables: []
      #relations: []
      #touches: []
      +timestamps: true
      #hidden: []
      #visible: []
      #fillable: []
      #guarded: array:1 [▶]
    }
  ]
}

如何查看返回的基本数组?

我知道这个问题很老,但不敢相信没有得到回答

您需要将雄辩的模型转换为数组,以显示它

{{ dd($all->toArray()) }} 
更多信息请点击此处: