我在控制器中创建了以下数组:
$appointmentLocation = compact("address1", "address2");
return view('appointments.show')->with(['appointmentLocation' => $appointmentLocation]);
我想在我的视图中使用刀片显示它:
{{ $appointmentLocation->address1 }}
但我明白了:Trying to get property of non-object
当我dd($appointmentLocation);
我得到了
array:2 [▼
"address1" => "101 York st."
"address2" => "Suite 1"
]
你知道缺少什么吗?所以我可以使用{{ $appointmentLocation->address1 }}
显示?