42 lines
973 B
PHP
42 lines
973 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
|
|
class Technician extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'employee_id',
|
|
'email',
|
|
'phone',
|
|
'specialization',
|
|
'is_active',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
public function repairOrders(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(RepairOrder::class)
|
|
->withPivot('is_lead')
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function repairTasks(): HasMany
|
|
{
|
|
return $this->hasMany(RepairTask::class);
|
|
}
|
|
}
|