123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Services\Violation;
- abstract class ViolationAbstract
- {
- protected $media;
- protected $user;
- public function __construct($media)
- {
- $this->media = $media;
- }
- public static function make($model)
- {
- if (in_array($model->field, ['headimgurl'])) {
- return new Avatar($model);
- } elseif (in_array($model->field, ['nickname'])) {
- return new Nickname($model);
- } elseif (in_array($model->field, ['introduce'])) {
- return new Introduce($model);
- } elseif (in_array($model->field, ['photo_src', 'photo_1', 'photo_2', 'photo_3', 'photo_4'])) {
- return new Photo($model);
- } elseif (in_array($model->field, ['question'])) {
- return new Question($model);
- } elseif (in_array($model->field, ['voice'])) {
- return new Voice($model);
- } elseif (in_array($model->field, ['invite_answer'])) {
- return new InviteAnswer($model);
- } elseif (in_array($model->field, ['invite_voice'])) {
- return new InviteVoice($model);
- } elseif (in_array($model->field, ['invite_sing'])) {
- return new InviteSing($model);
- } elseif (in_array($model->field, ['invite_paint'])) {
- return new InvitePaint($model);
- }
- }
- abstract public function handle();
- }
|