<?php

namespace Modules\User\Http\Resources;

use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
use Modules\User\Facades\UserSign;

class UserSignResource extends JsonResource
{

    public function toArray($request): array
    {
        return [
            'continue_days' => $this->continue_days,
            'counts'        => $this->counts,
            'last_sign_at'  => (string) $this->last_sign_at,
            'today_signed'  => !UserSign::canSign($this->user, Carbon::today()),
        ];
    }

}