'Vue',
11 => 'Laravel',
];
const PRIORITY = [
10 => 'High',
11 => 'Meduim',
12 => 'Low',
];
protected function priorityStatus(): Attribute
{
return Attribute::make(
get: function (mixed $value, array $attributes) {
switch ($attributes['priority']) {
case '10':
return '' . self::PRIORITY[$attributes['priority']] . '';
break;
case '11':
return '' . self::PRIORITY[$attributes['priority']] . '';
break;
case '12':
return '' . self::PRIORITY[$attributes['priority']] . '';
break;
default:
# code...
break;
}
},
set: fn($value) => $value,
);
}
public function project()
{
return $this->belongsTo(Project::class, 'project_id');
}
public function assigned()
{
return $this->belongsTo(Employee::class, 'assigned_id');
}
}