how to show unix timestamp in blade view from created_at or updated_at field in database laravel?

$string = '2019-03-17 19:10:30';

$obj = new stdClass;
$obj->created_at = $string;

$collection = [$obj];

foreach ($collection as $k => &$v) {
    $collection[$k]->created_at = strtotime($v->created_at);
}

//var_dump($collection);

or

$string = '2019-03-17 19:10:30';

$obj = new stdClass;
$obj->created_at = $string;

$collection = [$obj];

array_walk($collection, function (&$item, $key) {
    $item->created_at = strtotime($item->created_at);
});

//var_dump($collection);

Or in your case

    public function viewArchives()
    {
        $data = Archive::select('created_at')->get();
        foreach ($data as $k => &$v) {
            $v->created_at = strtotime($v->created_at);
        }
        return view('view.archives', compact('data'));
    }

or

    public function viewArchives()
    {
        $data = Archive::select('created_at')->get();
        array_walk($data, function (&$item, $key) {
            $item->created_at = strtotime($item->created_at);
        });
        return view('view.archives', compact('data'));
    }

This is good place to use array_walk() function.