本文整理汇总了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
}
示例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);
}