我正在使用 Laravel 5.8,我想在cart.blade.php
Blade 上设置一个会话变量,如下所示:
@php
$conflicted = '';
@endphp
@if($conflicting && ($prd[0]->prd_delivery == 'city_free_delivery' || $prd[0]->prd_delivery == 'country_free_delivery'))
@php Session::put($conflicted , '0') @endphp
<p style="color:red;">
This product has free delivery but it can not be set because of service area conflict of other products
</p>
@endif
@if(!$conflicting && ($prd[0]->prd_delivery == 'country_free_delivery'))
@php Session::put($conflicted , '1') @endphp
<p style="color:red;">
Country Free Delivery
</p>
@endif
@if(!$conflicting && ($prd[0]->prd_delivery == 'city_free_delivery'))
@php Session::put($conflicted , '2') @endphp
<p style="color:red;">
City Free Delivery
</p>
@endif
现在checkout.blade.php
,我需要检查$conflicted
变量的会话值。
那么如何在 Blade 上检查会话值?
因为使用get
andhas
方法,我可以检查会话密钥名称。