久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='xFVlS'></tfoot>

  • <i id='xFVlS'><tr id='xFVlS'><dt id='xFVlS'><q id='xFVlS'><span id='xFVlS'><b id='xFVlS'><form id='xFVlS'><ins id='xFVlS'></ins><ul id='xFVlS'></ul><sub id='xFVlS'></sub></form><legend id='xFVlS'></legend><bdo id='xFVlS'><pre id='xFVlS'><center id='xFVlS'></center></pre></bdo></b><th id='xFVlS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xFVlS'><tfoot id='xFVlS'></tfoot><dl id='xFVlS'><fieldset id='xFVlS'></fieldset></dl></div>
        <bdo id='xFVlS'></bdo><ul id='xFVlS'></ul>

    1. <small id='xFVlS'></small><noframes id='xFVlS'>

        <legend id='xFVlS'><style id='xFVlS'><dir id='xFVlS'><q id='xFVlS'></q></dir></style></legend>

        在 Eloquent 模型事件中獲取先前的屬性值

        Get previous attribute value in Eloquent model event(在 Eloquent 模型事件中獲取先前的屬性值)

        <small id='DMoHr'></small><noframes id='DMoHr'>

          <legend id='DMoHr'><style id='DMoHr'><dir id='DMoHr'><q id='DMoHr'></q></dir></style></legend>
        • <tfoot id='DMoHr'></tfoot>
            <tbody id='DMoHr'></tbody>
            • <bdo id='DMoHr'></bdo><ul id='DMoHr'></ul>

                <i id='DMoHr'><tr id='DMoHr'><dt id='DMoHr'><q id='DMoHr'><span id='DMoHr'><b id='DMoHr'><form id='DMoHr'><ins id='DMoHr'></ins><ul id='DMoHr'></ul><sub id='DMoHr'></sub></form><legend id='DMoHr'></legend><bdo id='DMoHr'><pre id='DMoHr'><center id='DMoHr'></center></pre></bdo></b><th id='DMoHr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='DMoHr'><tfoot id='DMoHr'></tfoot><dl id='DMoHr'><fieldset id='DMoHr'></fieldset></dl></div>

                  本文介紹了在 Eloquent 模型事件中獲取先前的屬性值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  有沒有辦法在 savingupdating 事件中查看模型屬性的舊/以前值?

                  例如.是否有以下可能:

                  User::updating(function($user){if ($user->username != $user->old->username) doSomething();});

                  解決方案

                  好吧,我是偶然發現的,因為它目前不在文檔中...

                  有一個 getOriginal() 方法可以返回原始屬性值的數組:

                  User::updating(function($user){if ($user->username != $user->getOriginal('username')) {做一點事();}//如果你需要多個屬性,你可以使用://$originalAttributes = $user->getOriginal();//$originalUsername = $originalAttributes['username'];});

                  <塊引用>

                  小心,在 Laravel 7 之前 getOriginal 忽略屬性類型轉換.

                  Is there a way to see the old/previous value of a model's attribute in its saving or updating event?

                  eg. Is something like the following possible:

                  User::updating(function($user)
                  {
                      if ($user->username != $user->old->username) doSomething();
                  });
                  

                  解決方案

                  Ok, I found this quite by chance, as it's not in the documentation at present...

                  There is a getOriginal() method available which returns an array of the original attribute values:

                  User::updating(function($user)
                  {
                      if ($user->username != $user->getOriginal('username')) {
                          doSomething();
                      }
                  
                      // If you need multiple attributes you may use:
                      // $originalAttributes = $user->getOriginal();
                      // $originalUsername = $originalAttributes['username']; 
                  });
                  

                  Be careful, prior to Laravel 7 getOriginal ignores attribute type casting.

                  這篇關于在 Eloquent 模型事件中獲取先前的屬性值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)
                    <bdo id='S8o8b'></bdo><ul id='S8o8b'></ul>
                  • <small id='S8o8b'></small><noframes id='S8o8b'>

                          <tbody id='S8o8b'></tbody>
                        <i id='S8o8b'><tr id='S8o8b'><dt id='S8o8b'><q id='S8o8b'><span id='S8o8b'><b id='S8o8b'><form id='S8o8b'><ins id='S8o8b'></ins><ul id='S8o8b'></ul><sub id='S8o8b'></sub></form><legend id='S8o8b'></legend><bdo id='S8o8b'><pre id='S8o8b'><center id='S8o8b'></center></pre></bdo></b><th id='S8o8b'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='S8o8b'><tfoot id='S8o8b'></tfoot><dl id='S8o8b'><fieldset id='S8o8b'></fieldset></dl></div>
                        <tfoot id='S8o8b'></tfoot>
                      1. <legend id='S8o8b'><style id='S8o8b'><dir id='S8o8b'><q id='S8o8b'></q></dir></style></legend>

                          • 主站蜘蛛池模板: 成人精品免费视频 | 欧美黑人体内she精在线观看 | 成人性视频免费网站 | 亚洲二区精品 | 欧美一区二区三区 | 中文字幕一区在线观看视频 | 国产一区二区三区在线看 | 久久国产精品精品国产色婷婷 | 国产视频欧美 | 久久视频一区 | 精品视频一区二区三区四区 | 国产精品久久久久久久久久免费看 | 国产精品1区 | 欧美福利视频一区 | 色视频网站 | 粉嫩粉嫩芽的虎白女18在线视频 | 国产精品视频免费观看 | 激情欧美一区二区三区中文字幕 | 中文字幕日韩一区二区 | 欧美色人 | 精品国产乱码久久久久久88av | 91看片视频 | 天天综合永久入口 | 一二三区在线 | 亚洲精品一区二区在线观看 | 国产精品毛片一区二区在线看 | 91精品中文字幕一区二区三区 | 特级丰满少妇一级aaaa爱毛片 | 亚洲精品自在在线观看 | 日韩免费av | 成人性生交大片免费看r链接 | 久久99一区二区 | 日韩在线大片 | 亚洲欧美日本国产 | 国产1区2区在线观看 | 东京av男人的天堂 | 狠狠狠色丁香婷婷综合久久五月 | 亚洲精品中文字幕在线观看 | 免费观看的黄色网址 | 国产成人精品一区二区三区在线 | 欧美成人一区二区三区 |