index.edge

44 lines | 1.146 kB Blame History Raw Download
@layout('layouts.main')

@section('content')

<section class="box is-full-width">
  <h3 class="is-size-3">Contact Actions</h3>
  <ul>
    <li><a href="{{ route('/contacts/create') }}">Add Contact</a></li>
  </ul>
</section>

<p>There are {{ contacts.length }} total contacts.</p>

<section class="box">
  <table class="table">
    <thead class="thead">
      <tr>
        <th>Last Name</th>
        <th>First Name</th>
        <th>Email</th>
        <th>Phone</th>
        <th>Action</th>
      </tr>
    </thead>
    <tbody class="tbody">
      @each(contact in contacts)
      <tr>
        <td>{{ contact.last_name }}</td>
        <td>{{ contact.first_name }}</td>
        <td>{{ contact.email}}</td>
        <td>{{ contact.phone }}</td>
        <td>
          <form action="{{ route('/contacts.destroy', { id: contact.id }) + '?_method=DELETE'}}" method="post">
            {{ csrfField() }}
            <button type="submit" name="button" class="is-small button is-danger" onclick="return confirm('Are you sure you want to delete this contact?');">Delete</button>
          </form>
        </td>
      </tr>
      @endeach
    </tbody>
  </table>
</section>

@endsection