Guest User

AddUserLogin

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