49 lines
943 B
PHP
49 lines
943 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Worker extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'phone',
|
|
'nationality',
|
|
'age',
|
|
'salary',
|
|
'availability',
|
|
'experience',
|
|
'religion',
|
|
'bio',
|
|
'category_id',
|
|
'verified',
|
|
'status',
|
|
];
|
|
|
|
protected $casts = [
|
|
'verified' => 'boolean',
|
|
'salary' => 'decimal:2',
|
|
];
|
|
|
|
public function category()
|
|
{
|
|
return $this->belongsTo(WorkerCategory::class, 'category_id');
|
|
}
|
|
|
|
public function skills()
|
|
{
|
|
return $this->belongsToMany(Skill::class, 'worker_skills');
|
|
}
|
|
|
|
public function documents()
|
|
{
|
|
return $this->hasMany(WorkerDocument::class);
|
|
}
|
|
}
|