38 lines
657 B
PHP
38 lines
657 B
PHP
<?php
|
|
|
|
namespace Modules\Labors\Models;
|
|
|
|
use App\Traits\HasPublicIdentifier;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Labor extends Model
|
|
{
|
|
use HasPublicIdentifier;
|
|
|
|
protected $table = 'labors';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'category',
|
|
'hourly_rate',
|
|
'status',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'hourly_rate' => 'decimal:2',
|
|
];
|
|
}
|
|
|
|
public function scopeActive($query)
|
|
{
|
|
return $query->where('status', 'active');
|
|
}
|
|
|
|
public function skills()
|
|
{
|
|
return $this->belongsToMany(Skill::class, 'labor_skills');
|
|
}
|
|
}
|