<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title></title>
  <link
    href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
    rel="stylesheet"
  >
</head>

<body>
  <div class="container mt-2">
    <div class="row">
      <div class="col-lg-12 margin-tb">
        <div class="pull-left">
          <h2></h2>
        </div>
        <div class="pull-right mb-2">
          <a
            class="btn btn-success"
            href="{{ route('apples.create') }}"
          > Create
            Apple</a>
        </div>
      </div>
    </div>
    @if ($message = Session::get('success'))
      <div class="alert alert-success">
        <p>{{ $message }}</p>
      </div>
    @endif
    <table class="table-bordered table">
      <thead>
        <tr>
          <th>S.No</th>
          <th>Apple Name</th>
          <th>Apple Email</th>
          <th>Apple Address</th>
          <th width="280px">Action</th>
        </tr>
      </thead>
      <tbody>
        @foreach ($apples as $Apple)
          <tr>
            <td>{{ $Apple->id }}</td>
            <td>{{ $Apple->name }}</td>
            <td>{{ $Apple->email }}</td>
            <td>{{ $Apple->address }}</td>
            <td>
              <form
                action="{{ route('apples.destroy', $Apple->id) }}"
                method="POST"
              >
                <a
                  class="btn btn-primary"
                  href="{{ route('apples.edit', $Apple->id) }}"
                >Edit</a>
                @csrf
                @method('DELETE')
                <button
                  class="btn btn-danger"
                  type="submit"
                >Delete</button>
              </form>
            </td>
          </tr>
        @endforeach
      </tbody>
    </table>
    {!! $apples->links() !!}
  </div>
</body>

</html>
