MIF_E31221305/TA_API/app/Models/TailorSpecialization.php

29 lines
559 B
PHP

<?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');
}
}