Skip to content

Instantly share code, notes, and snippets.

@oktavianto
Created August 15, 2017 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oktavianto/2b2302e1d3cf16e8411f350fe5dc9cab to your computer and use it in GitHub Desktop.
Save oktavianto/2b2302e1d3cf16e8411f350fe5dc9cab to your computer and use it in GitHub Desktop.
<!-- create.blade.php -->
@extends('layouts.app')
@section('content')
<form method="post" action="{{url('home')}}">
{{csrf_field()}}
<div class="form-group row">
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Nama Guru</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Nama Guru" name="nama_guru">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">NIP</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="NIP" name="nip">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Password</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Password" name="password">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Tempat Lahir</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Tempat Lahir" name="tempat_lahir">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Tanggal Lahir</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Tanggal Lahir" name="tanggal_lahir">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">No Telp</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="No Telp" name="no_telp">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Email</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Email" name="email">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Level</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Level" name="level">
</div>
</div>
<div class="form-group row">
<label for="smFormGroupInput" class="col-sm-2 col-form-label col-form-label-sm">Alamat</label>
<div class="col-sm-10">
<textarea name="alamat" rows="8" cols="80"></textarea>
</div>
</div>
<div class="form-group row">
<div class="col-md-2"></div>
<input type="submit" class="btn btn-primary">
</div>
</form>
@endsection
<!-- edit.blade.php -->
@extends('layouts.app')
@section('content')
<form method="post" action="{{action('GuruController@update', $id_guru)}}">
{{csrf_field()}}
<input name="_method" type="hidden" value="PATCH">
<div class="form-group row">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Nama Guru</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" value="{{$guru->nama_guru}}" name="nama_guru">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">NIP</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" value="{{$guru->nip}}" id="lgFormGroupInput" placeholder="NIP" name="nip">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Password</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Password" name="password" value="{{$guru->password}}">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Tempat Lahir</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Tempat Lahir" name="tempat_lahir" value="{{$guru->tempat_lahir}}">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Tanggal Lahir</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Tanggal Lahir" name="tanggal_lahir" value="{{$guru->tempat_lahir}}">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">No Telp</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="No Telp" name="no_telp" value="{{$guru->tanggal_lahir}}">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Email</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Email" name="email" value="{{$guru->email}}">
</div>
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Level</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="Level" name="level" value="{{$guru->level}}">
</div>
</div>
<div class="form-group row">
<label for="smFormGroupInput" class="col-sm-2 col-form-label col-form-label-sm">Alamat</label>
<div class="col-sm-10">
<textarea name="alamat" rows="8" cols="80">{{$guru->alamat}}</textarea>
</div>
</div>
<div class="form-group row">
<div class="col-md-2"></div>
<input type="submit" value="update" class="btn btn-primary">
</div>
</form>
@endsection
<!-- index.blade.php -->
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<a href="{{url('/home/create')}}" class="btn btn-success btn-block">+ Add Guru</a>
<br>
<table class="table table-striped table-responsive table-bordered">
<thead>
<tr>
<th>NIP</th>
<th>Nama Guru</th>
<th>Edit</th>
<th>Hapus</th>
</tr>
</thead>
<tbody>
@foreach($guru as $post)
<tr>
<td>{{$post['nip']}}</td>
<td>{{$post['nama_guru']}}</td>
<td><a href="{{action('GuruController@edit', $post['id_guru'])}}" class="btn btn-primary btn-block">Edit</a></td>
<td>
<form action="{{action('GuruController@destroy', $post['id_guru'])}}" method="post">
{{csrf_field()}}
<input name="_method" type="hidden" value="DELETE">
<button class="btn btn-danger btn-block" type="submit">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment