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

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

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

    <legend id='Ds9Wg'><style id='Ds9Wg'><dir id='Ds9Wg'><q id='Ds9Wg'></q></dir></style></legend>
    <tfoot id='Ds9Wg'></tfoot>
        <bdo id='Ds9Wg'></bdo><ul id='Ds9Wg'></ul>

    1. 如何從 Laravel 中的數(shù)據(jù)庫重新加載/刷新模型?

      How to reload/refresh model from database in Laravel?(如何從 Laravel 中的數(shù)據(jù)庫重新加載/刷新模型?)
        <tbody id='QmwVr'></tbody>
      • <tfoot id='QmwVr'></tfoot>
          <bdo id='QmwVr'></bdo><ul id='QmwVr'></ul>

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

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

              <i id='QmwVr'><tr id='QmwVr'><dt id='QmwVr'><q id='QmwVr'><span id='QmwVr'><b id='QmwVr'><form id='QmwVr'><ins id='QmwVr'></ins><ul id='QmwVr'></ul><sub id='QmwVr'></sub></form><legend id='QmwVr'></legend><bdo id='QmwVr'><pre id='QmwVr'><center id='QmwVr'></center></pre></bdo></b><th id='QmwVr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QmwVr'><tfoot id='QmwVr'></tfoot><dl id='QmwVr'><fieldset id='QmwVr'></fieldset></dl></div>
                本文介紹了如何從 Laravel 中的數(shù)據(jù)庫重新加載/刷新模型?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                在我的一些測試中,我創(chuàng)建了一個用戶模型,并運行了一些需要保存某些屬性的方法.在 Rails 中,我通常會調(diào)用諸如 user.reload 之類的東西,它會重新填充數(shù)據(jù)庫中的屬性.

                In some of my tests, I have a user model I have created and I run some methods that need to save certain attributes. In rails, I would typically call something like user.reload which would repopulate the attributes from the database.

                laravel 有沒有辦法做到這一點?我通讀了 api 并找不到它的方法:http://laravel.com/api/4.1/Illuminate/Database/Eloquent/Model.html 任何關于正確"方法的想法?

                Is there a way in laravel to do that? I read through the api and couldn't find a method for it: http://laravel.com/api/4.1/Illuminate/Database/Eloquent/Model.html Any ideas on the "right" way to do this?

                推薦答案

                我也看不到.看起來你必須:

                I can't see it either. Looks like you'll have to:

                $model = $model->find($model->id);
                

                您也可以自己創(chuàng)建一個:

                You can also create one yourself:

                public function reload()
                {
                    $instance = new static;
                
                    $instance = $instance->newQuery()->find($this->{$this->primaryKey});
                
                    $this->attributes = $instance->attributes;
                
                    $this->original = $instance->original;
                }
                

                剛剛在這里測試了它,它看起來有效,但不確定這能走多遠,Eloquen 是一個相當大的類.

                Just tested it here and it looks it works, not sure how far this goes, though, Eloquen is a pretty big class.

                這篇關于如何從 Laravel 中的數(shù)據(jù)庫重新加載/刷新模型?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關文檔推薦

                Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                PHP PDO ODBC connection(PHP PDO ODBC 連接)
                Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                    <tbody id='C1GRE'></tbody>

                        <bdo id='C1GRE'></bdo><ul id='C1GRE'></ul>
                      • <small id='C1GRE'></small><noframes id='C1GRE'>

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

                        • <tfoot id='C1GRE'></tfoot>
                        • 主站蜘蛛池模板: 亚洲欧洲成人 | 中文字幕一区二区三区不卡在线 | 国产精品自拍视频 | 欧美精品欧美精品系列 | 午夜电影福利 | a级片网站 | 久久精品色欧美aⅴ一区二区 | 黄色免费网址大全 | 国产精品国产精品国产专区不卡 | 噜噜噜色网| 成人av网站在线观看 | 天天干精品 | 午夜免费网 | 亚洲精品日韩一区二区电影 | a欧美 | 亚洲一区二区三区免费在线观看 | 欧美日韩国产高清 | 亚洲网站在线观看 | 国产精品18hdxxxⅹ在线 | 人人干视频在线 | 超碰在线免费av | 亚洲狠狠丁香婷婷综合久久久 | 日韩三级在线观看 | 日韩欧美一级片 | 国产午夜精品一区二区三区嫩草 | 精品国产不卡一区二区三区 | 亚洲精品乱码 | 91久久综合亚洲鲁鲁五月天 | 午夜视频网站 | 日本一区二区三区四区 | 国产91丝袜在线播放 | 欧美久久久久久久久 | 婷婷激情五月网 | 97人人澡人人爽91综合色 | 国产精品福利在线观看 | 日本中文字幕一区 | 精品视频在线观看 | 成人精品鲁一区一区二区 | 成人免费观看男女羞羞视频 | 性一爱一乱一交一视频 | 成人不卡在线 |