<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Carbon\Carbon;

/**
 * Admin
 * @mixin Builder
 * @method static Builder|static where($column, $operator = null, $value = null, $boolean = 'and')
 * @method static Builder|static create($data)
 * @method static Builder|static insert($array)
 *
 */
class BaseModel extends Authenticatable
{
    use HasApiTokens, Notifiable;

    protected $table = '';
    protected $hidden = ['created_at', 'updated_at'];
    protected $fillable = [];

    protected function getCreatedAtAttribute($value): string
    {
        return Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
    }

    protected function getUpdatedAtAttribute($value): string
    {
        return Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
    }
}