<?php

namespace Modules\Store\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Brand\Models\Brand;

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

    protected $fillable =
    [
        'email',	'phone','whatsapp',	'facebook',	'twitter',	'instagram',	'logo'	,'bank_account',	'status_show_sold'	,'tax_percentage'
    ];

    /**
     * Get current description of the the Room
     * @return HasOne
     */
    public function currentDescription() :HasOne
    {
        return $this->hasOne(StoreDescription::class)->where('language_id', currentLanguage()->id);
    }

    public function brands()
    {
        return $this->belongsToMany(Brand::class,'store_brands');
    }
}
