<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
class HomeLogos extends Model
{
    protected $table = 'home_logos';
    protected $fillable = ['name', 'slug', 'status', 'image'];
    protected $translatable = ['name'];
    public function getAttributes()
    {
        foreach($this->translatable as $attribute) {
            $locale = app()->getLocale();
            $localizedKey = "{$attribute}_{$locale}";
            if (isset($this->attributes[$localizedKey])) {
                $this->attributes[$attribute] =  (empty($this->attributes[$localizedKey]))?$this->attributes["{$attribute}"]:$this->attributes[$localizedKey];
            }
        }
        return $this->attributes;
    }

    public function getImageAttribute($icon){

        return get_uploaded_image_url( $icon, 'home_logo_image_upload_dir', 'camera_placeholder.png' );
        
    }

    
}
