Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 仅当用户选择的所有注册类型的总价大于0时,才显示一些HTML_Php_Laravel - Fatal编程技术网

Php 仅当用户选择的所有注册类型的总价大于0时,才显示一些HTML

Php 仅当用户选择的所有注册类型的总价大于0时,才显示一些HTML,php,laravel,Php,Laravel,在我看来,我有这样一个理由: @foreach($selectedRtypes as $k => $selectedRtype) @foreach(range(1,$selectedRtype['quantity']) as $val) .... @endforeach @endforeach 如果用户选择的所有注册类型的总价大于0,我想在blade视图中显示一些html 你知道怎样才能做到吗 {dd$selectedRtypes}}显示: array:2 [▼

在我看来,我有这样一个理由:

@foreach($selectedRtypes as $k => $selectedRtype)
    @foreach(range(1,$selectedRtype['quantity']) as $val)
    ....
    @endforeach
@endforeach
如果用户选择的所有注册类型的总价大于0,我想在blade视图中显示一些html

你知道怎样才能做到吗

{dd$selectedRtypes}}显示:

array:2 [▼
  "general" => array:6 [▼
    "quantity" => "2"
    "price" => 5
    "subtotal" => 10
    "total" => 10
    "questions" => Collection {#243 ▼
      #items: array:1 [▶]
    }
    "id" => 1
  ]
  "plus" => array:6 [▼
    "quantity" => "1"
    "price" => 10
    "subtotal" => 10
    "total" => 20
    "questions" => Collection {#247 ▼
      #items: []
    }
    "id" => 2
  ]
我不知道下面这样是否正确,因为我只检查了一种注册类型的价格:

@foreach($selectedRtypes as $k => $selectedRtype)
    @foreach(range(1,$selectedRtype['quantity']) as $val)
    ....
           @if($selectedRtype['price']>0)
                <p>show this html</p>
            @endif
    @endforeach
@endforeach

将价格保存在另一个变量中,如 $price=0; $price=$price+$selectedType['price']

然后如果$price>0,做点什么