<?php

namespace App\Domains\Virtual\Repositories;

use Carbon\Carbon;
use App\Core\Repository;
use App\Models\Virtual\OrderCardPartition as Model;
use App\Domains\Virtual\Repositories\Concerns\OrderCardConcern;

class OrderCardPartitionRepository extends Repository
{
    use OrderCardConcern;

    /**
     * 是否关闭缓存
     *
     * @var boolean
     */
    protected $cacheSkip = false;

    /**
     * 是否开启数据转化
     *
     * @var bool
     */
    protected $needTransform = false;

    /**
     * @var array
     */
    protected $fieldSearchable = [
        'id'         => '=',
        'created_at' => 'like',
    ];

    public static $tables = [
       0 => 'virtual_order_cards',
       1 => 'virtual_order_renewal_cards',
       2 => 'virtual_order_renewal_package_cards',
       3 => 'virtual_order_flows_package_cards',
       7 => 'virtual_order_upgrade_cards',
    ];

    public function model()
    {
        return Model::class;
    }

    /**
     * 数据格式化
     *
     * @param mixed $result
     *
     * @return mixed
     */
    public function transform($model)
    {
        return $model->toArray();
    }

    /**
     * 查询条件
     *
     * @return void
     */
    public function newest()
    {
        return $this;
    }
}
