I am using laravel v 4.2 .. I want to create an 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 ()}}
Mistake:
Undefined property: Illuminate \ Database \ Eloquent \ Collection :: $ id (View: C: \ xampp \ htdocs \ Laravel 4 \ projectLaravel \ app \ views \ matakuliahs \ edit.blade.php)
Thank you for your attention and your help.
collections properties php undefined
Febry Damatraseta Fairuz
source share