我和Laravel合作。
我有这个观点:
<div class="col-md-12">
<h2>Selecciona al cliente que pertenece el proyecto</h2>
@foreach ($clients as $key => $client)
<div class="radio">
<label>
<input type="radio" name="client" value="{{$client->name}}">
{{$client->name}}
</label>
</div>
@endforeach
</div>
我怎样才能打印变量,在这里有两个div?
<div class="col-md-6">Here</div>
<div class="col-md-6">Here the second half</div>
谢谢!
我想要两个div与class =&#34; col-md-6&#34;在class =&#34; col-md-12&#34;在左侧显示1/2的数据,在右侧显示另一个1/2。
已解决
比我想象的更容易..
<div class="col-md-12">
<h2>Selecciona al cliente que pertenece el proyecto</h2>
@foreach ($clients as $key => $client)
<div class="radio">
<div class="col-md-3">
<label><input type="radio" name="client" value="{{$client->name}}">{{$client->name}}</label>
</div>
</div>
@endforeach
希望帮助别人!
答案 0 :(得分:1)
你试试:
$counter = 0;
<h2>Selecciona al cliente que pertenece el proyecto</h2>
@foreach ($clients as $key => $client)
@if(counter == 0 || counter % 2 == 0){
echo '<div class="col-md-12">';
}
<div class="col-md-6">
<div class="radio">
<label>
<input type="radio" name="client" value="{{$client->name}}">
{{$client->name}}
</label>
</div>
@if(counter == 0 || counter % 2 == 0){
echo ' </div>';
}
$counter ++;
</div>
@endforeach
我不做php,也许语法不正确,但你拿了一个 看看我的想法