本文整理汇总了PHP中app\Member::whereNotIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::whereNotIn方法的具体用法?PHP Member::whereNotIn怎么用?PHP Member::whereNotIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Member
的用法示例。
在下文中一共展示了Member::whereNotIn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$this->validate($request, ['full_name' => 'required|string']);
$duplicate = Member::whereNotIn('id', [$id])->where('full_name', $request->full_name)->where('department_id', Auth::user()->department_id)->first();
if ($duplicate) {
return response()->json(true);
}
$member = Member::where('id', $id)->first();
$member->full_name = $request->full_name;
// $member->date_hired = $request->date_hired;
// $member->team_leader_id = $request->team_leader_id;
// get the difference of months from date hired to present
// $tenure = date_diff(Carbon::today(), date_create($request->date_hired))->format("%m");
// $member->experience = $tenure < 3 ? 'Beginner' : (($tenure > 3 && $tenure < 6) ? 'Moderately Experienced' : 'Experienced');
$member->save();
return $member->id;
}