0
我想將動態值傳遞給大門以防止刀片中的塊,例如。如果我想通過刀片頁面打印偶數。我可以通過@can將動態值傳遞給門嗎?
@for($i=0;$i<=10;$i++)
@can('print-even',$i) // i know its not possible i want to is there any other way
<div > div to display </div>
@endcan
@endfor
在AuthSerivceProvider.php
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
$gate->define('print-even', function($number){
return $number % 2 == 0;
});
}
像明智
,我想知道有沒有辦法做到傳遞動態值門?
非常感謝你花花公子@Hectorda –