Php 我想使用fill将数据保存在DB中,但出现错误
我想读取和覆盖现有数据 ProjectController.phpPhp 我想使用fill将数据保存在DB中,但出现错误,php,laravel,query-builder,laravel-5.8,Php,Laravel,Query Builder,Laravel 5.8,我想读取和覆盖现有数据 ProjectController.php public function update(Request $request,$id) { $param = Project::find($id); $param = fill($request)->save(); return redirect('/project'); } 我收到此错误,无法使用fill Call to undefined function App\Http\Controll
public function update(Request $request,$id)
{
$param = Project::find($id);
$param = fill($request)->save();
return redirect('/project');
}
我收到此错误,无法使用fill
Call to undefined function App\Http\Controllers\fill()
我试过了
$param = Project::fill($request)->save();
但我犯了这个错误
Non-static method Illuminate\Database\Eloquent\Model::fill() should not be called statically
还有这个
public function update(Request $request,$id)
{
$param = Project::find($id);
$param->fill($request)->save();
return redirect('/project');
}
就是这样
Argument 1 passed to Illuminate\Database\Eloquent\Model::fill() must be of the type array, object given, called in
在添加所有()之后,它运行良好
感谢您的合作在完成填充后使用所有工具
$param->fill($request->all())->save();
使用所有后填充工作
$param->fill($request->all())->save();
这个函数是在哪里创建的?@Adam Hull我正在projectcontroller中编写它不需要是
Project::fill
@AdamHull我试过$param=Project::fill($request)->save();但非静态方法illumb\Database\elounce\Model::fill()不应使用$project=newproject静态调用$项目->填写($request)->保存()代码>此函数是在哪里创建的?@Adam Hull我正在项目控制器中编写它是否不需要Project::fill
@AdamHull我尝试$param=Project::fill($request)->save();但非静态方法illumb\Database\elounce\Model::fill()不应使用$project=newproject静态调用$项目->填写($request)->保存()代码>