Skip()函数不起作用[Laravel 5]

时间:2015-09-23 12:46:45

标签: laravel-5 skip take

我正在尝试在Laravel 5中使用skip and take功能...当我只使用take()时,它会工作但如果我添加skip()则不会......

这是我的代码:

public function orderWhat($what){
           $this->what = $what;
           //QUERY FOR GROUPS AND PRODJECT_GROUP
           $userCondition = function($q){
                        $q->where('user_id',Auth::id())->where('project_id',$this->id)->skip(20)->take(20);
                    };

           //QUERY FOR COMMENTS AND PROJECT_COMMENT     
           $commentsCondition = function($q){
                        $q->where('project_id',$this->id)->where('order',$this->what)->orderBy('comments.id', 'DESC')-skip(20)->take(20);
                    };

           //RETURN PROJECT WITH COMMENTS        
           $results = Project::with(['comments' => $commentsCondition,'groups' => $userCondition])
                                ->whereHas('groups', $userCondition)
                                ->whereHas('comments', $commentsCondition)

                                ->get();
           return $results;
       }

当我添加skip()时,它只会返回空白页而不会出错。

1 个答案:

答案 0 :(得分:1)

首先:

您错过了">"

<connectionStrings configSource="some.config" />

结果:

web.config