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();
|
$task = new self();
|
||||||
|
|
||||||
@ -109,7 +115,8 @@ class Task
|
|||||||
public function persist(): array
|
public function persist(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'task_owner' => 1, // fake hard-coded user for now
|
'id' => $this->id ?? null,
|
||||||
|
'task_owner' => 1, // fake hard-coded user for now
|
||||||
'created_at' => Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
'name' => $this->getTitle(),
|
'name' => $this->getTitle(),
|
||||||
@ -117,7 +124,6 @@ class Task
|
|||||||
'start' => $this->getStartDt(),
|
'start' => $this->getStartDt(),
|
||||||
'end' => $this->getEndDt(),
|
'end' => $this->getEndDt(),
|
||||||
'status_id' => $this->getStatus()->value
|
'status_id' => $this->getStatus()->value
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user