예제 #1
0
 public function showSearch(Request $request)
 {
     $search = $request->input('query');
     if ($search) {
         $users = User::where('name', 'LIKE', '%' . $search . '%')->orWhere('calling_name', 'LIKE', '%' . $search . '%')->orWhere('email', 'LIKE', '%' . $search . '%')->orWhere('utwente_username', 'LIKE', '%' . $search . '%')->paginate(20);
     } else {
         $users = User::paginate(20);
     }
     return view('users.members.nested.list', ['users' => $users]);
 }
예제 #2
0
 /**
  * Execute the console command.
  */
 public function handle()
 {
     $users = User::where('birthdate', 'LIKE', '%-' . date('m-d'))->has('member')->get();
     if ($users->count() > 0) {
         $this->info('Sending birthday notification to ' . $users->count() . ' people.');
         $adminoverview = [];
         foreach ($users as $user) {
             $adminoverview[] = ['id' => $user->id, 'name' => $user->name, 'age' => $user->age()];
             $name = $user->name;
             $email = $user->email;
             Mail::queue('emails.users.birthdayemail', ['user' => $user], function ($message) use($name, $email) {
                 $message->to($email, $name)->from('internal@' . config('proto.emaildomain'), config('proto.internal'))->subject('Happy birthday!');
             });
         }
         // For some super strange reason we cannot queue this e-mail... Well...
         Mail::queue('emails.users.birthdaylist', ['users' => $adminoverview], function ($message) {
             $message->to('board@' . config('proto.emaildomain'), 'S.A. Proto Board')->subject('Birthdays of today!');
         });
         $this->info("Done!");
     } else {
         $this->info("There are no jarige joppen today.");
     }
 }
예제 #3
0
 public function postEmail(Request $request)
 {
     $user = User::where('email', $request->email)->first();
     if ($user !== null) {
         AuthController::dispatchPasswordEmailFor($user);
         $request->session()->flash('flash_message', 'We\'ve dispatched an e-mail to you with instruction to reset your password.');
         return Redirect::route('homepage');
     } else {
         $request->session()->flash('flash_message', 'We could not find a user with the e-mail address you entered.');
         return Redirect::back();
     }
 }