<?php

namespace Modules\Subscribe\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Package\Models\Package;
use Modules\Shipping\Models\Shipping;
use Modules\Store\Models\Store;
use Modules\User\Enums\AccountStatusEnum;
use Modules\User\Models\Address;
use Modules\User\Models\User;
use Modules\User\Models\Visitor;
use Modules\User\Services\AccountService;
use Modules\Way\Models\Way;
use Modules\Coupon\Models\Coupon;

class Subscribe extends Model
{
    //use soft delete
    use SoftDeletes;

    protected $fillable =
    [
        'token'	,'payment_id'	,'payment_log'	,'start_date'	,'end_date',	'total'	,'package_id'	,'store_id'
    ];

    public function getDateAttribute()
    {
        $date = date('d',strtotime($this->created_at));
        $date .= ' '.__('web.monthes.'.date('m',strtotime($this->created_at)));
        $date .= ' '.date('Y',strtotime($this->created_at));
        return $date;
    }

    public function store()
    {
        return $this->belongsTo(Store::class)->withTrashed();
    }

    public function package()
    {
        return $this->belongsTo(Package::class)->withTrashed();
    }

}
