public function postComments($id) { $owner = Post::find($id); $in = Input::all(); PostComment::create(['id' => $id, 'StudentID' => Auth::user()->StudentID, 'commentboxes' => $in['message']]); PostNotification::create(['StudentID' => Auth::user()->StudentID, 'OwnerID' => $owner->StudentID, 'agroup' => 0, 'post_id' => $id, 'grouppageID' => 0, 'grouppagepostID' => 0, 'eventID' => 2, 'seen' => 0]); }
public function newNotifications($id) { $notifications = PostNotification::with('posts', 'doer', 'event')->where('OwnerID', Auth::user()->StudentID)->where('id', '>', $id)->orderBy('created_at', 'DESC')->get(); $lastID = PostNotification::where('OwnerID', Auth::user()->StudentID)->orderBy('created_at', 'DESC')->first(); //return $notifications; return View::make('validated.notification.new', compact('notifications', 'lastID')); }
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]); } } }