feat: add id setter for the Task model
This commit is contained in:
parent
0e44c78af6
commit
46c6dd6e58
@ -88,7 +88,13 @@ class Task
|
||||
}
|
||||
|
||||
|
||||
public static function fromArray($taskData): Task
|
||||
public function setId(int $id): Task
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function fromArray($taskData): self
|
||||
{
|
||||
$task = new self();
|
||||
|
||||
@ -109,6 +115,7 @@ class Task
|
||||
public function persist(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id ?? null,
|
||||
'task_owner' => 1, // fake hard-coded user for now
|
||||
'created_at' => Carbon::now()->toDateTimeString(),
|
||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||
@ -117,7 +124,6 @@ class Task
|
||||
'start' => $this->getStartDt(),
|
||||
'end' => $this->getEndDt(),
|
||||
'status_id' => $this->getStatus()->value
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user