<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class TailorSpecialization extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'icon',
    ];

    protected $casts = [
        'id' => 'integer'
    ];

    /**
     * The tailors that belong to the specialization.
     */
    public function tailors()
    {
        return $this->belongsToMany(User::class, 'tailor_specialization_user')
                    ->where('role', 'penjahit');
    }
} 