【发布时间】:2014-11-23 00:27:17
【问题描述】:
我正在使用 laravel v 4.2.. 我想创建更新记录。 你能帮我..这段代码有什么问题... 这是我的代码:
MatakuliahsController.php
公共功能编辑($id) { //$matakuliahs = $this->matakuliahs->find($id); $matakuliahs = Matakuliah::where('id','=',$id)->get(); if(is_null($matakuliahs)){ return Redirect::route('matakuliahs.index'); } 返回视图::make('matakuliahs.edit',compact('matakuliahs')); }edit.blade.php
{{ Form::open(array('autocomplete' => 'off', 'method' => 'PATCH', 'route' => array('matakuliahs.update', $matakuliahs->id))) }} ... {{ 表单::close() }}错误是:
未定义属性:Illuminate\Database\Eloquent\Collection::$id(查看:C:\xampp\htdocs\Laravel 4\projectLaravel\app\views\matakuliahs\edit.blade.php)感谢您的关注和帮助..
【问题讨论】:
标签: php collections properties undefined