<?php

namespace Modules\Mall\Models;

use App\Models\Model;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Mall\Models\Traits\BelongsToShop;

class Delivery extends Model
{

    use BelongsToShop,
        Cachable,
        SoftDeletes;

    protected $table = 'mall_deliveries';

    const TYPE_BY_COUNT  = 1;
    const TYPE_BY_WEIGHT = 2;

    const TYPE_MAP = [
        self::TYPE_BY_COUNT  => '按数量',
        self::TYPE_BY_WEIGHT => '按重量',
    ];

    /**
     * Notes   : 模板对应的规则
     * @Date   : 2021/3/15 1:11 下午
     * @Author : < Jason.C >
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function rules(): HasMany
    {
        return $this->hasMany(DeliveryRule::class);
    }

}
