当前位置: 首页>>代码示例>>PHP>>正文


PHP Project::whereIn方法代码示例

本文整理汇总了PHP中app\models\Project::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::whereIn方法的具体用法?PHP Project::whereIn怎么用?PHP Project::whereIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Project的用法示例。


在下文中一共展示了Project::whereIn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: projectsUserIsMember

 public function projectsUserIsMember($userid)
 {
     $userInProjects = DB::table('project_user')->where('user_id', '=', $userid)->get(['project_id']);
     $wherein = [];
     foreach ($userInProjects as $value) {
         $wherein[] = $value->project_id;
     }
     return Project::whereIn('id', $wherein)->get();
 }
开发者ID:ronal2do,项目名称:dave_brubeck,代码行数:9,代码来源:ProjectRepository.php

示例2: getIndex

 public function getIndex($criteria = Null)
 {
     Session::put('step', '1');
     Session::put('last_insert_id', '');
     $searchKey = \Input::get('srch-term') ? \Input::get('srch-term') : Null;
     $projects = Project::whereIn('active', [0, 1]);
     if ($criteria != Null) {
         switch ($criteria) {
             case "active":
                 $projects = Project::where('active', 1);
                 break;
             case "inactive":
                 $projects = Project::where('active', 0);
                 break;
             case "featured":
                 $projects = Project::where('featured', 1);
                 break;
             case "suspended":
                 $projects = Project::where('status', 1);
                 break;
             case "flaged":
                 $projects = Project::where('flag', 1);
                 break;
             case "uflaged":
                 $projects = Project::where('user_flagged', 1);
                 break;
         }
     }
     if ($searchKey != Null) {
         $projects->Where(function ($query) use($searchKey) {
             //echo $searchKey; exit;
             $query->where('name', 'LIKE', '%' . $searchKey . '%');
         });
     }
     $results = $projects->orderBy('id', 'desc')->paginate($this->show_per_page);
     return view('admin.project.index', ['projects' => $results, 'searchKey' => $searchKey, 'dataStat' => $this->project_repo->projectDataStat()]);
 }
开发者ID:udayc,项目名称:travel,代码行数:37,代码来源:MessageController.php

示例3: postSearch

 public function postSearch(Request $request)
 {
     $searchKey = $request->get('srch-term');
     //DB::connection()->enableQueryLog();
     $results = Project::whereIn('active', [0, 1])->Where(function ($query) use($searchKey) {
         $query->where('name', 'LIKE', '%' . $searchKey . '%');
     })->paginate($this->show_per_page);
     //$queries = DB::getQueryLog();
     if ($results) {
         return view('admin.project.index', ['users' => $results, 'result_count' => count($results), 'dataStat' => $this->project_repo->projectDataStat(), 'searchKey' => $searchKey]);
     } else {
         return Redirect::back()->with('message', 'No results found');
     }
 }
开发者ID:udayc,项目名称:travel,代码行数:14,代码来源:ProjectController.php


注:本文中的app\models\Project::whereIn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。