<?php

namespace Yas\Company\Models;

use Yas\Company\Contracts\Company as CompanyContract;
use Webkul\Core\Eloquent\TranslatableModel;
use Illuminate\Support\Facades\Storage;

class Company extends TranslatableModel implements CompanyContract
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'company';

    public $translatedAttributes = [
        'name',
    ];

    protected $fillable = [
        'status',
        'street_address',
        'city',
        'state',
        'country',
        'postcode',
        'email',
        'phone',
        'payment_info',
    ];

    protected $with = ['translations'];

     /**
     * Appends.
     *
     * @var array
     */
    protected $appends = ['logo_url', 'url'];

    /**
     * Get image url for the category image.
     *
     * @return string
     */
    public function getLogoUrlAttribute()
    {
        if (! $this->logo_path) {
            return;
        }

        return Storage::url($this->logo_path);
    }
}
