i'm using laravel v 4.2.. i want to create update record. can you help me.. what's wrong with this code... this is my code :
MatakuliahsController.php
public function edit($id) { //$matakuliahs = $this->matakuliahs->find($id); $matakuliahs = Matakuliah::where('id','=',$id)->get(); if(is_null($matakuliahs)){ return Redirect::route('matakuliahs.index'); } return View::make('matakuliahs.edit',compact('matakuliahs')); }
edit.blade.php
{{ Form::open(array('autocomplete' => 'off', 'method' => 'PATCH', 'route' => array('matakuliahs.update', $matakuliahs->id))) }} ... {{ Form::close() }}
Error is :
Undefined property: Illuminate\Database\Eloquent\Collection::$id (View: C:\xampp\htdocs\Laravel 4\projectLaravel\app\views\matakuliahs\edit.blade.php)
thanks for your attention and your help..