【发布时间】:2015-02-02 23:35:22
【问题描述】:
我在向数据中插入新记录时遇到问题
有一个videocontroller的部分:
$galleryName = Input::get('name');
$galleryID = Foto::create($galleryName);
这里的型号:
class Foto extends Eloquent {
public static function create($name)
{
return DB::table('galleries')->insert_get_id(array('name' => $name));
}
}
Foto::create()的声明应该兼容
Illuminate\Database\Eloquent\Model::create(array $attributes)
我应该解决什么问题?
【问题讨论】:
-
像@JosephSilber 一样,或者使用返回单个元素数组的
Input::only('name')。
标签: database laravel model insert