我在Creating default object from empty value
上遇到$analyses->result = 1.0;
问题我在我的数据库中检查了所有这些列。
$analysis = new Analysis;
$analysis->psubid = '1';
$analysis->subjectid = '1';
$analyses->result = 1.0;
$analyses->rtd = 2.0;
$analyses->save();
$Analysis = Analysis::all();
return $Analysis;
答案 0 :(得分:0)
您正在使用$analysis
名称启动变量,并在某些语句中使用$analyses
。为所有
$analysis = new Analysis;
$analysis->psubid = '1';
$analysis->subjectid = '1';
$analysis->result = 1.0;
$analysis->rtd = 2.0;
$analysis->save();
$Analysis = Analysis::all();
return $Analysis;