public function investorAndUserInsert()
 {
     $user = new user_login();
     $user->user_name = $this->investor_user_name;
     $user->user_password = $this->password;
     $user->user_type = 'i';
     $user->save();
     $this->setScenario('insert');
     if ($this->save()) {
         return true;
     } else {
         $user->delete();
         return false;
     }
 }
 public function customerAndUserInsert()
 {
     $user = new user_login();
     $user->user_name = $this->customer_user_name;
     $user->user_password = $this->password;
     $user->user_type = 'c';
     $user->save();
     $this->setScenario('insert');
     if ($this->save()) {
         $profile = (new Profile())->createProfile($this->customer_user_name, 'Dummy/Path');
         $endorse = (new Endorsement())->createEndorsement($this->customer_user_name);
         return true;
     } else {
         $user->delete();
         return false;
     }
 }
 public function getUserType($username)
 {
     $userType = user_login::find('user_type')->where(['user_name' => $username])->one();
     return $userType->user_type;
 }