@extends('layouts.layout')
@section('content')
<!--data cabe -->
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-body">
                    @if(Session::has('alert-success'))
                        <div class="alert alert-success">
                            {{ Session::get('alert-success') }}
                        </div>
                    @endif
                    <a href="{{route('cabe.create')}}" class="btn btn-info pull-right">Tambah Data</a><br><br>
                    <table class="table table-striped">
                        <tr>
                            <th>No</th>
                            <th>Foto</th>
                            <th>Nama</th>
                            <th>Family</th>
                            <th>Tanggal Tanam</th>
                            <th>Usia Tanaman</th>
                            <th>Hama</th>
                            <th>Action</th>
                        </tr>
                        <?php $no=1; ?>
                        @foreach($cabes as $cabe)
                            <tr>
                                <td>{{$no++}}</td>
                                <td><img src="<?php echo asset("image/$cabe->foto")?>" style="max-height:40px; max-width: 40px; margin-top:10px;" /> </img> </td>
                                <td>{{$cabe->nama}}</td>
                                <td>{{$cabe->family}}</td>
                                <td>{{$cabe->tanggal_tanam}}</td>
                                <td>{{$cabe->usia}}</td>
                                <td>{{$cabe->hama}}</td>
                                <td>
                                    <form method="POST" action="{{ route('cabe.destroy', $cabe->id) }}" accept-charset="UTF-8">
                                        <input name="_method" type="hidden" value="DELETE">
                                        <input name="_token" type="hidden" value="{{ csrf_token() }}">
                                        <a href="{{route('cabe.edit', $cabe->id)}}" class="btn btn-primary">Edit</a>
                                        <a href="{{route('cabe.show', $cabe->id)}}" class="btn btn-warning">Lihat</a>
                                        <input type="submit" class="btn btn-danger" onclick="return confirm('Anda yakin akan menghapus data ?');" value="Delete">
                                    </form>
                                </td>
                            </tr>
                        @endforeach
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!--end data cabe -->
@endsection