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


PHP Project::whereNotIn方法代码示例

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


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

示例1: finalizeProject

 public function finalizeProject($id)
 {
     $user = Auth::user();
     $name = $user->name;
     $user_id = $user->id;
     $project = Project::where("id", $id)->get();
     $project_id = $project[0]->id;
     $project_name = $project[0]->name;
     $finalizedProject = new FinalizedProjects();
     $finalizedProject->user_id = $user_id;
     $finalizedProject->user = $name;
     $finalizedProject->project_id = $project_id;
     $finalizedProject->project_name = $project_name;
     $finalizedProject->save();
     $finalizedProject = FinalizedProjects::where('user', $name)->get();
     //Get finalized project
     $finalized_pn = "";
     if (sizeof($finalizedProject) != 0) {
         $finalized_pn = $finalizedProject[0]->project_name;
     }
     $reservation = Reservations::where('user', $name)->get();
     //Get reserved projects from the verified user
     $reserved = array();
     //Create array to store reserved project ids
     foreach ($reservation as $res) {
         array_push($reserved, $res->project_id);
         //Save each reserved project id to the array
     }
     $projectR = Project::whereNotIn('id', $reserved)->get();
     //Get projects which are not reserved from the Project table
     return view('pages.ViewProjectsStudent', compact('projectR', 'reservation', 'finalized_pn'));
     //Show finalized project
 }
开发者ID:npamudika,项目名称:Projex,代码行数:33,代码来源:PageController.php

示例2: checkDuplicate

 public function checkDuplicate(Request $request)
 {
     $project = $request->id ? Project::whereNotIn('id', [$request->id])->where('name', $request->name)->where('department_id', $request->department_id)->first() : Project::where('name', $request->name)->where('department_id', $request->department_id)->first();
     return response()->json($project ? true : false);
 }
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:5,代码来源:ProjectController.php


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