public function acceptJoin($id) { $request = GroupPageJoin::find($id); $check = GroupPage::hasRights($request->grouppageID, Auth::user()->StudentID); if ($check && !GroupPage::isMember($request->grouppageID, $request->StudentID)) { $request->delFlag = 1; $request->save(); $add = GroupPageMember::create(['grouppageID' => $request->grouppageID, 'StudentID' => $request->StudentID]); if ($add) { PostNotification::create(['StudentID' => Auth::user()->StudentID, 'OwnerID' => $request->StudentID, 'agroup' => 1, 'grouppageID' => $request->grouppageID, 'eventID' => 3]); } } }
public static function isRequested($id) { $check = GroupPageJoin::where('grouppageID', $id)->where('StudentID', Auth::user()->StudentID)->where('delFlag', 0)->first(); return $check ? true : false; }