<?php

namespace App\Models;

use App\Traits\Description;
use App\Traits\Image;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Worker extends Model
{
    use HasFactory, Image, Description;

    protected $fillable = [
        'name',
        'image',
        'position_tr',
        'position_ru',
        'position_en',
        'description_az',
        'description_ru',
        'description_en',
        'order'
    ];

    public function position() :?string
    {
        return $this->getAttribute("position_" . str_replace('_', '-', app()->getLocale())) ?? $this->getAttribute('position_tr');
    }
}
