Laravels的DD辅助功能是否正常运行? [英] Is Laravels' DD helper function working properly?

查看:53
本文介绍了Laravels的DD辅助功能是否正常运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢使用dd函数进行调试.这次,当我使用它显示约会列表时,我看不到(没有可单击的箭头)属性和原始中的数据.我改为显示括号[ …19],不确定为什么.

I like to use the dd function to debug. This time when I use it to display a list of appointments, I can't see (no clickable arrow) the data in the attributes and original. I get the brackets [ …19] displayed instead, not sure why.

Collection {#3061 ▼
  #items: array:548 [▼
    0 => Appointment {#821 ▼
      #table: "appointments"
      #fillable: array:16 [ …16]
      #connection: null
      #primaryKey: "id"
      #perPage: 15
      +incrementing: true
      +timestamps: true
      #attributes: array:19 [ …19]
      #original: array:19 [ …19]
      #relations: array:2 [ …2]
      #hidden: []
      #visible: []
      #appends: []
      #guarded: array:1 [ …1]
      #dates: []
      #dateFormat: null
      #casts: []
      #touches: []
      #observables: []
      #with: []
      #morphClass: null
      +exists: true
      +wasRecentlyCreated: false
    }
    1 => Appointment {#822 ▶}
    2 => Appointment {#823 ▶}
    3 => Appointment {#824 ▶}
    4 => Appointment {#825 ▶}
    5 => Appointment {#826 ▶}
    6 => Appointment {#827 ▶}
    7 => Appointment {#828 ▶}

在列表的后面,我什至看不到约会中的内容(没有箭头):

And later in the list, I can't even see inside an appointment (no arrows):

    81 => Appointment {#902 ▶}
    82 => Appointment {#903 ▶}
    83 => Appointment {#904 ▶}
    84 => Appointment {#905 ▶}
    85 => Appointment {#906 …23}
    86 => Appointment {#907 …23}
    87 => Appointment {#908 …23}
    88 => Appointment {#909 …23}
    89 => Appointment {#910 …23}
    90 => Appointment {#911 …23}

但是当我使用var_dump时,我的数据看起来不错:

But when I use var_dump, my data looks fine :

    array(548) {
      [0]=>
      array(21) {
        ["id"]=>
        int(149)
        ["appointmenttype_id"]=>
        NULL
        ["appointmentlocationtype_id"]=>
        NULL
        ["appointment_start"]=>
        object(Carbon\Carbon)#812 (3) {
          ["date"]=>
          string(26) "2015-12-21 07:00:00.000000"
          ["timezone_type"]=>
          int(3)
          ["timezone"]=>
          string(16) "America/New_York"
        }
        ["appointment_end"]=>
        object(Carbon\Carbon)#811 (3) {
          ["date"]=>
          string(26) "2015-12-21 09:00:00.000000"
          ["timezone_type"]=>
          int(3)
          ["timezone"]=>
          string(16) "America/New_York"
        }

还有其他人遇到过这种情况吗?

Anyone else experienced that situation?

推荐答案

这是返回结果列表过大的一个不为人知的警告.通常,dd()是要快速概述要返回的数据,并且可以很好地处理较小数据组的向下钻取".一旦达到一定数量(我可能忘记了确切的数字,可能是500个?),该功能将不再起作用.

This is a not-so-known caveat of returning too large a list of results. Generally, dd() is meant to be a quick overview of the data you are returning, and handles "drill down" well on smaller groups of data. Once you reach a certain number (I forget the exact one, 500 maybe?), that functionality no longer works.

如果您绝对需要在代码中的某处使用该数据之前将其查看,请在get()结果之前使用limit()子句,或使用dd($example[0])查看单个结果的详细信息.希望有帮助!

If you absolutely need to see this data before using it in your code somewhere, use a limit() clause before you get() the results, or use dd($example[0]) to see a single results' details. Hope that helps!

这篇关于Laravels的DD辅助功能是否正常运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆