コード例 #1
0
 function getDetailedClientsApi($id)
 {
     try {
         $userDet = ClientList::where('userid', '=', $id)->firstOrFail();
     } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         $extraInfo = ['dob' => "", 'gender' => "", 'height' => "", 'weight' => "", 'mobileNum' => "", 'homeNum' => "", 'address' => "", 'city' => "", 'postalCode' => "", 'state' => "", 'country' => "", 'occupation' => "", 'maritalStatus' => "", 'nextOfKin' => ""];
         $userDet = users::where('id', '=', $id)->select('id', 'firstName', 'lastName', 'email')->firstOrFail();
         $userDet = array_merge((array) $userDet["attributes"], $extraInfo);
     }
     return $userDet;
 }
コード例 #2
0
 /**
  * test for deleting users data
  *
  * @return void
  */
 public function testDelete()
 {
     //delete record
     ClientList::where('email', '*****@*****.**')->delete();
     users::where('email', '*****@*****.**')->delete();
     ClientList::where('email', '*****@*****.**')->delete();
     users::where('email', '*****@*****.**')->delete();
     ClientList::where('email', '*****@*****.**')->delete();
     users::where('email', '*****@*****.**')->delete();
     //assert records are not in database
     $this->dontSeeInDatabase('clients', ['email' => '*****@*****.**']);
     $this->dontSeeInDatabase('clients', ['email' => '*****@*****.**']);
     $this->dontSeeInDatabase('clients', ['email' => '*****@*****.**']);
 }