當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。