我在控制器中有这个存储函数,我需要验证如果$type=“texto”,他创建了一个普通文本而不是一张卡片。
这是我的。blade视图文件,带有选项,但即使我选择'texto',他仍然创建一张卡片,甚至使用@if($dashboard->type==“texto”);
这是应用中的卡片,我需要在页脚有一个文本行,如果在表格中被选中。
有人能帮帮我吗? 谢啦!
您必须将type
与text
进行比较,而不是将texto
进行比较,因为您的选项值是text
。 在存储函数中。。
public function store(Request $request)
{
if($request->type == "text") {
// code when texto is selected
} else if($request->type == "card") {
// code when card is selected
}else {
// code for handling other options
}
}
刀片锉也一样。 您必须将$dashboard->type
与text
而不是texto
进行比较。