0
私はアウトを注文しようとしていますが、2つの基準に基づいて、明け方は一番上に来て、次に上がり、一度は能動的ではありません。私はララベルの見解でそれをしようとしています。これは私のコードです。上向きまたは後ろ向きに基づいてソートすることはできますが、アクティブにすることはできません。あなたがソート基準としてカスタム値を使用できるようにLaravelビュー、2つの基準に基づいて並べ替え
は@foreach($notes->sortBy('values') as $notification)
<tbody>
<tr>
<td> {{ $notification->website_url }} </td>
@if($notification->status('health') == 'up')
<td> {{ $notification->status('health') }} <span class="up"></span></td>
@else
<td> {{ $notification->status('health') }} <span class="down"></span></td>
@endif
<td> </td>
<td class="<?php echo $notification->active == 1 ? 'active' : '' ?>">
{{ $notification->active == 1 ? 'Yes' : 'No' }}
</td>
<td>
<a href="{{ route('notifications.edit', [$notification->id]) }}">
<input type="submit" name="showmore" value="show more"/>
</a>
</td>
<td></td>
</tr>
</tbody>
@endforeach
あなたは申し分なく正しいです。私はあなたのコードを試してみました。それは動作するように見えます。結果はちょっと変わった考えです。あなたがループから '$ notes-> sortBy( 'values')'を削除しましたか? –
1、01up active .... 2、00 down active ... 3,11 up not active –
? '$ notes'だけでなければなりません。 – Paul