<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 使用大量資料的方式新增(Mass Assignment)時無法新增 在 Laravel 若沒有在模型(Model)中`同時`設定「可以新增的欄位變數 `$fillable`」及「需要保護的欄位變數 `$guarded`」時,為了安全性著想,在做大量的新增或異動資料時(Mass Assignment),會無法正確的去新增或異動資料。 ### 設定「可以新增的欄位變數 `$fillable`」 設定你覺得允許做大量新增的欄位名稱 ~~~ class User extends Model { protected $fillable = ['first_name', 'last_name', 'email']; } ~~~ ### 設定「需要保護的欄位變數 `$guarded`」 我們可以指定某些欄位,不能被使用大量新增或異動,去變更欄位的資料值 ~~~ class User extends Model { protected $guarded = ['id', 'password']; } ~~~ 若我們想要讓模型(Model)可以被大量新增,且我們沒有需要保護的欄位時,我們還是需要設定 `$guarded` 變數為空陣列 `[]`,否則 Laravel 預會保護所有的欄位資料,讓你無法進行大量的新增或異動資料 ~~~ class User extends Model { protected $fillable = ['id', 'password', 'first_name', 'last_name', 'email']; protected $guarded = []; } ~~~ ### 參考資料 - [Eloquent ORM 新增、更新、刪除 - Laravel.tw](http://laravel.tw/docs/5.0/eloquent#insert-update-delete) - [Laravel Eloquent Save to DB Using Create - Unhelpful Error](http://stackoverflow.com/questions/22338149/laravel-eloquent-save-to-db-using-create-unhelpful-error) - [Eloquent Create Method - Always inserts blank entries.](https://laracasts.com/discuss/channels/general-discussion/eloquent-create-method-always-inserts-blank-entries) - [Unable to create a model with Eloquent create method. Error telling MassAssignMentException](http://stackoverflow.com/questions/18699866/unable-to-create-a-model-with-eloquent-create-method-error-telling-massassignme)
                  <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>

                              哎呀哎呀视频在线观看