public function getAdvisorsInGroup($id)
 {
     $expertiseGroup = ExpertiseGroup::find($id);
     if ($id == 'all') {
         $advisors = Advisor::where('permissions', '<', 999)->get()->sortBy('last_name');
         return View::make('api.advisors.with-expertise-group', compact(['advisors']));
     }
     // $advisors = $expertiseGroup->getAdvisorsWhoHaveAnAvailabilityWithinGroup();
     $advisors = $expertiseGroup->getAdvisorsWhoHaveAnExpertiseWithinGroup('randomize');
     if ($advisors == false) {
         $advisors = '<h2>There are currently no advisors with an availability.</h2>';
         return View::make('api.advisors.with-expertise-group-none', compact(['advisors']));
     }
     return View::make('api.advisors.with-expertise-group', compact(['advisors']));
 }
Ejemplo n.º 2
0
 public function resetPassword()
 {
     $advisor = Advisor::where('email', Input::get('email'))->first();
     if ($advisor == null) {
         return Redirect::home()->with('message', 'There was no account associated with the email you provided.');
     }
     $advisorName = $advisor->first_name . ' ' . $advisor->last_name;
     $newPassword = str_random(8);
     $data = ['newPassword' => $newPassword];
     $advisor->password = Hash::make($newPassword);
     $advisor->save();
     \Mail::queue('emails.user.new-password', $data, function ($message) use($advisor, $advisorName) {
         $message->to($advisor->email, $advisorName)->subject('You have been assigned a new password.');
     });
     return Redirect::home()->with('message', 'Your new password will be sent to your email shortly.');
 }