I got this error while trying to do model binding in the update function in laravel 5.2
ErrorException in 046a57c821869475e492cad8f8ed30fde13dd919.php line 10: Undefined variable: post
This is my controller code
public function edit($id)
{
$post = Buku::find($id);
return view('buku.edit')->withBuku($post);
}
this is my modal form and I use Modal-Binding so it will load the data in the existing database
<div class="modal fade" id="edit_buku" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Edit Buku</h4>
</div>
<div class="modal-body">
{!! Form::model($post, ['route' => ['buku.update' , $post->id]]) !!}
<div class="form-group">
{{ Form::label('judul','Judul') }}
{{ Form::text('judul', null, ["class" => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('deskripsi','Deskripsi') }}
{{ Form::text('deskripsi', null, ["class" => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('pengarang','Pengarang') }}
{{ Form::text('pengarang', null, ["class" => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('tanggal_publikasi','Tanggal Publikasi') }}
{{ Form::text('tanggal_publikasi', null, ["class" => 'form-control']) }}
</div>
</div>
<div class="modal-footer">
{{ Form::submit('Submit', array('class' => 'btn btn-success')) }}
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
When I check the variable post, it is defined in my controller as u can see it but I am puzzled as the error said its not defined.. I searched everywhere i can for the solution but it doesnt seem to have any..