Not sure if this is the best solution but I solved this by replacing the current value of the date.
private function toTimestamp($date)
{
return Carbon::parse($date)->timestamp;
}
public function getById($id)
{
$result = Mission::findOrFail($id);
$result->start = $this->toTimestamp($result->start);
$result->end = $this->toTimestamp($result->end);
return $result;
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community