你好我有一个问题试图了解laravel,我试图将数据从一个函数传递到请求保存在数据库中,我不断收到此错误:尝试分配非对象的属性
public function active()
{
$activity = str_random(25);
$result = purchase::where('active', '=', $activity)->get()->first();
if(!$result){
return $activity;
}
}
public function store(AddOrder $request)
{
$user = new Bid();
$user = $request->all();
$user->activate = $this->active();
return $user;
}
非常感谢
答案 0 :(得分:0)
很抱歉找到了
已更改
public function store(AddOrder $request)
{
$user = new Bid();
$user = $request->all();
$user->activate = $this->active();
return $user;
}
到
public function store(AddOrder $request)
{
$user = new Bid();
$user = $request->all();
$user['activate'] = $this->active();
return $user;
}