<?php

namespace App\Http\Controllers\Admin\Invite;

use App\Http\Resources\Admin\Invite\PaintCollection;
use App\Models\Deed\PaintModel;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class PaintController extends Controller
{

    /**
     * 走心一画列表
     * @param  Request  $request
     * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
     */
    public function index(Request $request)
    {
        $paints = PaintModel::paginate(
            20,
            ['id', 'uid', 'name', 'pic_url', 'created_at', 'updated_at']
        );
        foreach ($paints as $paint) {
            $paint->user;
        }
        return new PaintCollection($paints);
    }
}
