这是我的代码,发生错误。
public function index(MoodOfTheDay $request)
{
$authUser = JWTAuth::parseToken()->toUser();
$datetime = new DateTime();
$currentDatetime = $datetime->format('Y-m-d H:i:s');
$subcategory_ids = $request->get('subcategory_ids');
$subcategories = Subcategory::whereIn('id', $subcategory_ids)->get();
$userFriends = $authUser->friendslist()->get();
$userFriendIds = $authUser->friendslist()->pluck('id')->toArray();
$authUser->removeMood();
foreach ($subcategories as $subcategory) {
$authUser->addMood($subcategory);
}
}
答案 0 :(得分:0)
您的removeMood()
像这样:
public function removeMood($userId) {
return $this->userMoods($userId)->detach();
}
$authUser->removeMood($authUser->id);
答案 1 :(得分:0)
请检查$manager = new MongoDB\Driver\Manager("mongodb://$username:$p@$hostPort");
$filter = array("sent_data.switchId"=>"db_sw_001");
$filter = array();
$options = array(
'limit'=>10,
'sort'=>array("_id"=>-1)
);
$query = new MongoDB\Driver\Query($filter, $options);
文件中的route
,
检查您的路线是否有参数将其删除
您的路线可能像这样:
web.php
将此更改为:
Route::post/get('/url/{parameter}' , 'controller@method')->name('route_name');