Laravel database insert query

后端 未结 1 1190
忘了有多久
忘了有多久 2021-01-17 17:07

I\'m trying to do simple insertion in database and im getting the following error

call_user_func_array() expects parameter 1 to be a valid callback, n

相关标签:
1条回答
  • 2021-01-17 17:38
    DB::table('users')->insert(
         array(
                'id'     =>   '1', 
                'name'   =>   'Dayle'
         )
    );
    

    or

    $values = array('id' => 1,'name' => 'Dayle');
    DB::table('users')->insert($values);
    

    But why are you inserting an ID? Should this not be an auto incremented value?

    0 讨论(0)
提交回复
热议问题