Advertisement
Guest User

AddUserLogin

a guest
Aug 19th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Sts\PleafCommon\BO;
  4.  
  5.  
  6. use Sts\PleafCore as PleafCore;
  7. use Sts\PleafCore\BusinessTransaction;
  8. use Sts\PleafCore\DefaultBusinessTransaction;
  9. use Sts\PleafCommon\Model\UserLogin;
  10. use Log;
  11.  
  12. class AddUserLogin extends DefaultBusinessTransaction implements BusinessTransaction {
  13.  
  14. public function getDescription(){
  15. return "changes here";
  16. }
  17.  
  18. public function prepare ($dto, $originalDto){
  19. // Add Validation Business
  20.  
  21. }
  22.  
  23. public function process ($dto, $originalDto){
  24.  
  25. $userLogin = new UserLogin();
  26. $userLogin->username = $dto["username"];
  27. $userLogin->datetime_login = $dto["datetime"];
  28. $userLogin->status_login = _YES;
  29. $userLogin->error_login = ' ';
  30. $userLogin->session_id = md5(rand(1,time()));
  31. $userLogin->datetime_logout = ' ';
  32. $userLogin->save();
  33.  
  34. }
  35.  
  36. protected function rules(){
  37.  
  38. return [
  39. "username" => "required",
  40. "datetime" => "required"
  41. ];
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement