Support the ongoing development of Laravel.io →
Requests Database Eloquent
Last updated 1 year ago.
0
Solution

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;
    }
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

marxi marxi Joined 4 Nov 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.