<?php

namespace Modules\User\Http\Controllers\Api\Invite;

use App\Api\Controllers\Controller;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Jason\Api\Api;
use Modules\Mall\Http\Resources\Api\Activity\ActivityBaseResource;
use Modules\Mall\Http\Resources\Api\Activity\ActivityResource;
use Modules\Mall\Models\Activity;
use Modules\User\Http\Resources\Invite\UserInviteCollection;
use Modules\User\Models\Identity;
use Modules\User\Models\Order;
use Modules\User\Models\UserInvite;
use Modules\User\User;

class IndexController extends Controller
{

    /**
     * Notes: 邀请码列表
     *
     * @Author: 玄尘
     * @Date: 2022/9/21 9:55
     * @param  Request  $request
     * @return JsonResponse
     */
    public function index(Request $request)
    {
        $status = $request->status ?? 1;
        $lists = UserInvite::query()
            ->ByUser(Api::user())
            ->where('status', $status)
            ->paginate();

        return $this->success(new UserInviteCollection($lists));
    }

}
