<?php

namespace App\Console\Commands\Partner;

use App\Events\AuditMedia;
use App\Models\PartnerModel;
use App\Models\User\UserModel;
use App\Services\User\ProfileService;
use Illuminate\Console\Command;

class CheckCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'partner:check';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $partners = PartnerModel::where('check_photo', 0)
            ->select('id', 'uid', 'photo_src')
            ->get();
        foreach ($partners as $partner) {
            dump($partner->id);
            event(new AuditMedia(
                $partner->uid,
                'image',
                'https://oss.pocketuniversity.cn' . $partner->photo_src,
                'photo_src',
                "uid={$partner->uid}"
            ));
        }
    }
}
