Answers for "break foreach laravel"

PHP
0

break foreach laravel

@forelse ($datatabel as $data)
  <tr>
  	<td>{{ $loop->iteration }}</td>
  	<td>{{ $data->name }}</td>
  	<td>
  		<button type="button" class="btn btn-primary">edit</button>
    	@forelse($data->subcategory as $subcategory)
    		@if($subcategory->category_id == $data->id)
    			<button type="button" class="btn btn-success" disabled style="cursor: not-allowed;">In Use</button>
    			@php break; @endphp {{-- put this --}}
      		@endif
      	@empty
        	<button type="button" class="btn btn-danger">delete</button>
        @endforelse
	</td>
  </tr>
@empty
  <tr>
    <td colspan="3" class="text-center">No Data Available</td>
  </tr>
@endforelse
Posted by: Guest on September-29-2021

Browse Popular Code Answers by Language