我正在尝试从/users/show.blade.php访问我的图像表。我在控制器中有这个...
if ( (firstCount = secondCount) and (secondCount = thirdCount) and (firstCount = ThirdCount) )
return true;
else
return false;
当我尝试在模板中使用$ my_images变量时,我得到$ my_images的未定义变量错误
我哪里错了?
答案 0 :(得分:2)
你应该试试这个:
public function show($id)
{
/* Get All CSCS Images For User */
$my_images= Image::all();
/* Get User From ID */
$user = User::find($id);
/* Return View */
return view('users.show',compact('user','my_images'));
}
您在刀片文件中将$my_images
名称作为image
传递,以获取此错误。