ViolationAbstract.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Services\Violation;
  3. abstract class ViolationAbstract
  4. {
  5. protected $media;
  6. protected $user;
  7. public function __construct($media)
  8. {
  9. $this->media = $media;
  10. }
  11. public static function make($model)
  12. {
  13. if (in_array($model->field, ['headimgurl'])) {
  14. return new Avatar($model);
  15. } elseif (in_array($model->field, ['nickname'])) {
  16. return new Nickname($model);
  17. } elseif (in_array($model->field, ['introduce'])) {
  18. return new Introduce($model);
  19. } elseif (in_array($model->field, ['photo_src', 'photo_1', 'photo_2', 'photo_3', 'photo_4'])) {
  20. return new Photo($model);
  21. } elseif (in_array($model->field, ['question'])) {
  22. return new Question($model);
  23. } elseif (in_array($model->field, ['voice'])) {
  24. return new Voice($model);
  25. } elseif (in_array($model->field, ['invite_answer'])) {
  26. return new InviteAnswer($model);
  27. } elseif (in_array($model->field, ['invite_voice'])) {
  28. return new InviteVoice($model);
  29. } elseif (in_array($model->field, ['invite_sing'])) {
  30. return new InviteSing($model);
  31. } elseif (in_array($model->field, ['invite_paint'])) {
  32. return new InvitePaint($model);
  33. }
  34. }
  35. abstract public function handle();
  36. }