OwnerObserver.php 601 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Observers;
  3. use App\Owner;
  4. class OwnerObserver
  5. {
  6. /**
  7. * 监听插入事件
  8. *
  9. * @param Owner $owner
  10. * @return void
  11. */
  12. public function created(Owner $owner)
  13. {
  14. app("OwnerAreaReportService")->notExistToInsert([$owner]);
  15. if(env('APP_ENV')=='production')
  16. app("OwnerService")->syncPush($owner);
  17. app("OwnerService")->createAuthority($owner);
  18. }
  19. public function updated(Owner $owner)
  20. {
  21. if(env('APP_ENV')=='production'){
  22. app("OwnerService")->syncUpdate($owner);
  23. }
  24. }
  25. }