Laravel Date and Time need to split

Dasun

Here is what i'm getting when i fetch data from its database.

enter image description here

So that i want to split into 2 different column.can anyone help me here? Here is the view.

<table class="table table-striped">
    <thead>
        <th>Trainee ID</th>
        <th>Name with initials</th>
        <th>On time</th>
    </thead>

    <tbody>
        @foreach($items as $item)
            <tr>
                <td>{{ $item->trainee_id }}</td>
                <td>{{ $item->name }}</td>
                <td>{{ $item->time }}</td>
            </tr>
        @endforeach
    </tbody>
</table>
Exprator
<table class="table table-striped">
              <thead>
                <th>Trainee ID</th>
                <th>Name with initials</th>
                <th>On Date</th>
                <th>On Time</th>

              </thead>

              <tbody>
                @foreach($items as $item)
                <?php 
                  $temp = explode(' ',$item->time);
                ?>
                 <tr>

              <td>{{ $item->trainee_id }} </td>
              <td>{{ $item->name}}</td>
              <td>{{ $temp[0] }}</td>
              <td>{{ $temp[1] }}</td>

                </tr>

                @endforeach
              </tbody>

      </table>

try this

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related