public function testGetTestimonialsForUser()
 {
     $user = User::find(1);
     $testimonials = $user->testimonials();
     $actual = get_class($testimonials);
     $expected = "Illuminate\\Database\\Eloquent\\Relations\\HasMany";
     $this->assertEquals($expected, $actual);
 }
 /**
  * Verify an account
  */
 public function getVerifyAccount()
 {
     $user_id = 0;
     $token = $_GET['token'];
     // look up the token
     $user_pending = UserPending::where('token', '=', $token)->first();
     if ($user_pending) {
         $user_id = $user_pending->user_id;
     }
     if ($user_id > 0) {
         $user = User::find($user_id);
         $user->active = 1;
         $user->save();
         UserPending::where('token', '=', $token)->delete();
         $this->response->redirectTo("/account-activated");
     } else {
         $this->response->withView('page-not-found')->withError("Page not found!")->withResponseCode(404)->render();
     }
 }
Esempio n. 3
0
 public function getVerifyAccount()
 {
     $user_id = 0;
     $token = $_GET['token'];
     // look up the token
     $user_pending = UserPending::where('token', '=', $token)->get();
     foreach ($user_pending as $item) {
         $user_id = $item->user_id;
     }
     if ($user_id > 0) {
         // make the user account active
         $user = User::find($user_id);
         $user->active = 1;
         $user->save();
         UserPending::where('token', '=', $token)->delete();
         header("Location: /account-activated");
         exit;
     } else {
         header("Location: /page-not-found");
         exit;
     }
 }
Esempio n. 4
0
 public function getTestDB()
 {
     $user = User::find(1);
     echo "User's name is " . $user->first_name . " " . $user->last_name;
 }
Esempio n. 5
0
 public function getVerifyAccount()
 {
     $user_id = 0;
     $token = $_REQUEST['token'];
     //look up the token
     $users_pending = UserPending::where('token', '=', $token)->first();
     if ($users_pending != null) {
         //echo $this->blade->render("verify-account");
         $user_id = $users_pending->user_id;
         $user = User::find($user_id);
         $user->active = 1;
         $user->save();
         //delete token from table
         UserPending::where('token', '=', $token)->delete();
         header("Location: /account-activated");
         exit;
     } else {
         header("Location: /page-not-found");
         exit;
     }
     //echo $this->blade->render("verify-account");
 }