<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                > ## 對象數據支持數組方式訪問和賦值 ``` $user = User::find(1); echo $user->name ; // 有效 echo $user['name'] // 同樣有效 $user->name = 'thinkphp'; // 有效 $user['name'] = 'thinkphp'; // 同樣有效 $user->save(); ``` > ## 對象格式轉換為數組格式 ``` $user = User::find(1); // 轉換為數組 dump($user->toArray()); // 隱藏指定屬性 dump($user->hidden(['create_time','update_time'])->toArray()); // 追加獲取器中生成的表中不存在的字段到屬性列表 dump($user->append(['status_text'])->toArray()); // 允許指定屬性輸出 dump($user->visible(['id','name','email'])->toArray()); // 如果結果集為數組非對象,則不能調用toArray方法,這時候需要把數組轉為對象再調用 $list = User::all(); if($list) { $list = collection($list)->toArray(); } // 還可以直接在模型類中定義數據集返回類型,這樣就都返回對象了,可以直接調用toArray protected $resultSetType = 'collection'; // 將關聯模型的屬性追加到結果集 $user = User::find(1); // profile為定義的關聯方法名,email和nickname為模型Profile的屬性 dump($user->appendRelationAttr('profile',['email','nickname'])->toArray()); // 如果是移除用:removeRelation(5.0.10+),同上 ``` > ## visible、hidden和append方法不僅支持數組,還支持數據集對象,同樣支持關聯模型 ``` $user = User::get(1,'profile'); // 隱藏profile關聯屬性的email屬性 dump($user->hidden(['profile'=>['email']])->toArray()); // 或者使用 dump($user->hidden(['profile.email'])->toArray()); ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看