lundi 6 août 2018

print readable message for tiny int value

I have a column PAID tinyint(1). Now I want to display this value 0/1 as UNPAID/PAID in view page table. How should I do this?

Also if the PAID column data is PAID then color it as green and if UNPAID then color it as BLUE. How can I do this?

controller code block to fetch data

function fetchData()
    {
        $ordered_books = OrderedBook::orderBy('id', 'DESC')->get()->toArray();
        return compact('ordered_books');
    }

view page table code block

 <table id="showBooksIn" class="table table-bordered gridview">
            <thead>
                <tr>
                    <th>BOOK ID</th>
                    <th>BILLED DATE</th>
                    <th>BILLED NUMBER</th>
                    <th>QUANTITY</th>
                    <th>PRICE</th>
                    <th>PAID</th>
                    <th>REMARKS</th>
                </tr>
            </thead> 
            <tbody>
                @foreach($ordered_books as $data)
                 <tr>
                     <td>  </td>
                     <td>  </td>
                     <td>  </td>
                     <td>  </td>
                     <td>  </td>
                     <td>  </td>
                     <td>  </td>
                 </tr>
                @endforeach
          </tbody>          
        </table>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire