public function sendNotificationsToAllEventInvitees($events) { foreach ($events as $event) { $creator = User::find($event->uid); $date = $event->date; $invitees = Invite::getInvites($event->eid); $this->sendNotificationsToInviteeList($invitees, $creator->firstname, $date); } }
public static function changeStatus($eid, $uid, $status) { $result = DB::table('invites')->where('eid', $eid)->where('uid', $uid)->update(['status' => $status]); if (!$result) { if (is_null(Invite::where('eid', $eid)->where('uid', $uid)->first())) { DB::table('invites')->insert(array('eid' => $eid, 'uid' => $uid, 'status' => $status)); } } }
public function postInvite(Request $request) { // check if already invited or not if (Invite::where('email', $request->email)->first() == null) { $user = Auth::user(); //create new invite $invite = new Invite(); $invite->email = $request->email; $invite->user()->associate($user); $invite->save(); $data = ['title' => $user->name . ' invited you to join CocaCola Rewards!', 'content' => 'Join us right now by signing up. Start acquiring points and claim your rewards!', 'email' => $invite->email]; //send mail to invited person Mail::send('emails.invite', $data, function ($message) use($data) { $message->to($data['email']); $message->subject('Invite to CocaCola Rewards'); }); } return redirect('dashboard'); }
public static function getInvitesFromEid($eid) { $invites = []; //Retrieving Invitees for Display $inviteDB = Invite::getInvitees($eid); foreach ($inviteDB as $entry) { array_push($invites, $entry->email); } return $invites; }
public function getUserInvitedEvents() { $invites = Invite::getActiveUserInvites(); $events = []; foreach ($invites as $invite) { $event_array = Event::getByInviteEID($invite->eid); foreach ($event_array as $single_event) { array_push($events, $single_event); } } return $events; }
public function newUser(Request $request) { $validator = \Validator::make($request->all(), ['invite-email' => 'required|unique:invite,email|email'], ['invite-email.required' => 'Полето с E-mail Ви, е задължително', 'invite-email.unique' => 'E-mail Ви е добавен към списъка за проверка, в скоро време ще получите поканата си.']); if ($validator->fails()) { \Session::flash('error_invite_mail', ''); return redirect()->back()->withErrors($validator)->withInput(); } $input['email'] = $request->get('invite-email'); Invite::create($input); \Session::flash('invite_email', 'След проверка на вашият E-mail, ще получите поканата си.'); return redirect(url('/')); }
public function index() { $subjects = collect(Subject::where('trash', '=', false)->get()->toArray())->groupBy('name')->count(); $partitions = Partition::where('trash', '=', false)->count(); $invites = Invite::count(); $questions = Question::where('trash', '=', false)->count(); $users = User::count(); $trash = ''; $testrooms = ''; if (\Entrust::hasRole('admin')) { $trash = Question::where('trash', '=', true)->count() + Subject::where('trash', '=', true)->count() + Partition::where('trash', '=', true)->count() + TestRoom::where('teacher_id', '=', \Auth::user()->id)->where('trash', '=', true)->count(); } elseif (\Entrust::hasRole('teacher')) { $testrooms = TestRoom::where('teacher_id', '=', \Auth::user()->id)->count(); } return view('admin.welcome', ['subjects' => $subjects, 'partitions' => $partitions, 'invites' => $invites, 'questions' => $questions, 'users' => $users, 'trash' => $trash, 'testrooms' => $testrooms]); }
/** * Function to validate and approve the invite and then adds it to the database * @param Request $request */ public function makeInviteUser(Request $request) { header('Access-Control-Allow-Origin: *'); $invite = new Invite(); echo $invite->makeInviteUser($request->input('inviteID'), $request->input('userHash'), $request->input('newPassword'), $request->input('contactNo'), $request->input('userFullName')); }
public function inviteDecline($eid, $uid) { try { if (Invite::getUserRSVP($eid) == "accepted") { $event = Event::find($eid); $event->attendees--; $event->save(); } Invite::changeStatus($eid, $uid, "declined"); } catch (Exception $e) { print '<script type="text/javascript">'; print 'alert("The system has encountered an error please try again later")'; print '</script>'; return view('errors.error_event'); } return view('inviteresponse')->with('is_full', false); }
/** * Function to get invite details * @param $inviteSenderEmailID * @param $inviteRecipientEmailID * @return string */ public function getInvite($inviteSenderEmailID, $inviteRecipientEmailID) { $return = "failure"; $status = $this->checkInviteStatus($inviteSenderEmailID, $inviteRecipientEmailID); if (strcmp($status, 'failure') != 0) { $invite = Invite::where('inviteSender', $inviteSenderEmailID)->where('inviteRecipient', $inviteRecipientEmailID)->get(); $return = $invite[0]; } return $return; }
public function postRegister(Request $request) { $validator = $this->validator($request->all()); if ($validator->fails()) { $this->throwValidationException($request, $validator); } Auth::login($this->create($request->all())); $user = Auth::user(); $user->ip = $request->ip(); $invited = Invite::where('email', $request->email)->first(); if ($invited) { $invited->accepted = 1; $invited->save(); $inviter = $invited->user; $inviter->points = $inviter->points + 100; $inviter->save(); } $user->save(); return redirect('dashboard'); }
public function inviteDecline($eid, $uid) { try { Invite::changeStatus($eid, $uid, "declined"); } catch (Exception $e) { print '<script type="text/javascript">'; print 'alert("The system has encountered an error please try again later")'; print '</script>'; return view('errors.error_event'); } return redirect('invite_response'); }
public function join(User $user, Group $group) { // if group is open anyone can join, else it's invite only if ($group->group_type == $group::OPEN) { return true; } elseif ($group->group_type == $group::CLOSED) { // do we have an invite already for this group and user? $invite = \App\Invite::where('email', $user->email)->where('group_id', $group->id)->count(); if ($invite == 1) { return true; } } return false; }
/** * Process the account creation from the form of inviteConfirm() */ public function inviteRegister(Request $request, Group $group, $token) { $this->validate($request, ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6']); $invite = \App\Invite::whereToken($token)->firstOrFail(); $invite->claimed_at = Carbon::now(); $user = new \App\User(); $user->name = $request->get('name'); $user->email = $request->get('email'); $user->password = bcrypt($request->get('password')); // in the strange event the user changes the email on the registration form, we cannot consider it is verified using the invite. if ($invite->email == $request->get('email')) { $user->verified = 1; } $user->save(); $membership = \App\Membership::firstOrNew(['user_id' => $user->id, 'group_id' => $group->id]); $membership->membership = \App\Membership::MEMBER; $membership->save(); Auth::login($user); flash()->info(trans('messages.you_are_now_a_member_of_this_group')); return redirect()->action('GroupController@show', $group->id); }
/** * @param integer $user_id * @param string $email * @return mixed */ public function findByUserIDandEmail($user_id, $email) { return Invite::where('user_id', $user_id)->where('email', $email)->first(); }