4
I am a beginner in this universe, and I am locked in my development into a simple function that I cannot understand. This code below gets a value from the database, and I would like in the color cell, the background to change as value, for example if the field for = 1
then the cell will be green.
<tbody>
@foreach($estoques as $row)
<tr>
<th scope="row">{{ $row->id }}</th>
<td>{{ $row->categoria->nome }}</td>
<td>{{ $row->cor }}</td>
<td>{{ $row->produto }}</td>
<td>{{ $row->marca }}</td>
<td>{{ $row->qtd }}</td>
<td>{{ $row->observacao }}</td>
</tr>
@endforeach
</tbody>
Thank you friend, I managed to advance in my development thanks to you, I only had to make this slight change so that it works only in the specific line <tbody> @foreach($stocks as $Row) <tr> <th Scope="Row">{{ $Row->id }}</th> <td>{{ $Row->category->name }}</td> <td<? php if ($Row->color == 2) {echo ' style="background-color:green;"';}? >>{{ $Row->cor }}</td> <td>{{ $Row->product }}</td> <td>{{ $Row->brand }}</td> <td>{{ $Row->Qtd }}</td> <td>{{ $Row->observation }}</td>#Xa; </>tr @endach
– leonardo silva
@leonardosilva blz!
– novic