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

      <bdo id='Eg7eW'></bdo><ul id='Eg7eW'></ul>
  1. <legend id='Eg7eW'><style id='Eg7eW'><dir id='Eg7eW'><q id='Eg7eW'></q></dir></style></legend>

  2. <tfoot id='Eg7eW'></tfoot>

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

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

    2. Laravel 模型函數(shù)“create"和“create"有什么區(qū)

      What#39;s difference between Laravel Model functions quot;createquot; and quot;insertquot;?(Laravel 模型函數(shù)“create和“create有什么區(qū)別?和“插入?)

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

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

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

          <tfoot id='uE68Z'></tfoot>
          • <bdo id='uE68Z'></bdo><ul id='uE68Z'></ul>

                <tbody id='uE68Z'></tbody>

                本文介紹了Laravel 模型函數(shù)“create"和“create"有什么區(qū)別?和“插入"?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                Laravel 模型允許使用兩個函數(shù)將值插入到數(shù)據(jù)庫表中.他們是

                Laravel Model allows two functions for inserting the values to the database table. They are

                創(chuàng)建:User::create(['id'=>1,'name'=>'stack']);

                插入:User::insert(['id'=>2,'name'=>'overflow']);

                我發(fā)現(xiàn)它們執(zhí)行類似的操作.它們有什么區(qū)別?

                I found they perform similar operations. What's difference between them?

                推薦答案

                insert() :

                如果你使用 insert() 方法,你不能默認 created_at 和 updated_at 數(shù)據(jù)庫列它將為空

                If you using insert() method you can't default created_at and updated_at database column it will be null

                DefaultUser::insert(['username'    =>  $request->username, 'city'  =>  $request->city, 'profile_image' =>  $request->profile_image]);
                

                <小時>

                create() :當我們使用 create 方法時,您必須在 fillable fields


                create() : when we use create method you must define this model in fillable fields

                添加模型

                 protected $fillable = ['username','city', 'profile_image'];
                

                添加控制器

                DefaultUser::create(['username'    =>  $request->username, 'city'  =>  $request->city, 'profile_image' =>  $request->profile_image]);
                

                那么我們就可以使用create方法而沒有**mass assignment error **基本上在這里,表定義的字段在您的模型中受到保護

                then we can use create method without **mass assignment error ** basically here , table defined fields are protected in your model

                您應該定義要使質量可分配的模型屬性.您可以使用模型上的 $fillable 屬性來執(zhí)行此操作

                這篇關于Laravel 模型函數(shù)“create"和“create"有什么區(qū)別?和“插入"?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關文檔推薦

                MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環(huán))
                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 個參數(shù))
                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@“l(fā)ocalhost的訪問被拒絕)
              1. <i id='Tqbqq'><tr id='Tqbqq'><dt id='Tqbqq'><q id='Tqbqq'><span id='Tqbqq'><b id='Tqbqq'><form id='Tqbqq'><ins id='Tqbqq'></ins><ul id='Tqbqq'></ul><sub id='Tqbqq'></sub></form><legend id='Tqbqq'></legend><bdo id='Tqbqq'><pre id='Tqbqq'><center id='Tqbqq'></center></pre></bdo></b><th id='Tqbqq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Tqbqq'><tfoot id='Tqbqq'></tfoot><dl id='Tqbqq'><fieldset id='Tqbqq'></fieldset></dl></div>

                    <tfoot id='Tqbqq'></tfoot>
                        <tbody id='Tqbqq'></tbody>

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

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

                          主站蜘蛛池模板: 在线免费黄色 | 国产伦一区二区三区四区 | 精品国产91 | 日韩成人在线视频 | 综合久久综合久久 | 国产精品久久久久影院色老大 | 毛片一区二区三区 | 欧美亚洲视频在线观看 | 欧美精品一区二区三区在线四季 | 精品一区二区三区在线观看 | 久久中文字幕电影 | 精品亚洲一区二区 | 黄色一级电影免费观看 | 日韩av一区二区在线观看 | 国户精品久久久久久久久久久不卡 | 欧美视频1 | 国产福利在线视频 | 久久精品国产免费 | 久久er99热精品一区二区 | 久久一级大片 | 91精品国产一区二区三区蜜臀 | 精品国产一区一区二区三亚瑟 | 婷婷久久五月天 | 欧美日韩亚洲视频 | 久久久久久美女 | 亚洲精品一区二区 | 欧美国产亚洲一区二区 | 国内自拍偷拍一区 | 欧美性大战久久久久久久蜜臀 | 久久国产精品-国产精品 | 黄网站在线播放 | 懂色av一区二区三区在线播放 | 久久99精品久久久久久琪琪 | 一区二区三区精品视频 | 免费日本视频 | 一区二区三区四区在线 | 在线免费av观看 | 国产一区二区三区四区在线观看 | 97精品一区二区 | 亚洲一区二区三区国产 | 中文字幕亚洲区 |