我有一些这样的代码
$editStuState = StuAtt::where('studentId' , '=' , $id)->first();
$editStuState -> leave +=1;
$editStuState -> present = $editStuState -> present-1;
$editStuState->update();
//OR
$editStuState->save();
return 'this is good';
我无法保存或更新我的数据,当我删除更新和保存相关行时,它可以打印文本。
这是dd($editStuState)
数据
StuAtt {#382 ▼
#table: "stu_attendance"
#connection: "mysql"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:7 [▼
"id" => "7"
"studentId" => "1"
"present" => "2"
"absent" => "1"
"leave" => "10"
"created_at" => "2018-04-16 11:17:41.176898"
"updated_at" => "2018-04-16 06:47:41.000000"
]
#original: array:7 [▼
"id" => "7"
"studentId" => "1"
"present" => "2"
"absent" => "1"
"leave" => "10"
"created_at" => "2018-04-16 11:17:41.176898"
"updated_at" => "2018-04-16 06:47:41.000000"
]
#changes: []
#casts: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: []
#touches: []
+timestamps: true
#hidden: []
#visible: []
#fillable: []
#guarded: array:1 [▶]
}
我也从 laravel 5.6 中得到了这个错误
InvalidArgumentException
Trailing data