我有模型用户和具有相同字段的新自定义集合。
using (Microsoft.Reporting.WebForms.LocalReport report = new LocalReport())
{
string appPath = AppDomain.CurrentDomain.BaseDirectory;
report.ReportPath = System.IO.Path.Combine(appPath, "Reports", RDLName.ToString());
foreach (KeyValuePair<string, object> dataSource in ReportDataSource)
{
report.DataSources.Add(new ReportDataSource(dataSource.Key, dataSource.Value));
}
if (ReportParameters != null)
{
foreach (KeyValuePair<string, object> parameter in ReportParameters)
{
report.SetParameters(new ReportParameter(parameter.Key, (parameter.Value == null ? null : parameter.Value.ToString())));
}
}
result = report.Render(Format);
report.Dispose();
return result;
}
Everyting很棒,但是当我尝试循环新的集合时,它不会检索推送的数据,并抛出 Undefined Propery 。
请提出任何建议,我完全被浪费了。
答案 0 :(得分:0)
您可以使用新的用户实例执行此操作:
$users = User::all();
$newUser = new User([
"name"=>'John',
"status"=>"pending",
"created_at"=> "-0001-11-30 00:00:00",
"updated_at"=> "-0001-11-30 00:00:00",
]);
// Trying to pull new to the main;
$users->push($newUser);