<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class SpecialController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    public function stMaarten()
    {
      $query = app('db')->select('SELECT tussenstand, creationdt FROM stmaarten ORDER BY id DESC LIMIT 0, 1');
      if(count($query))
      {
        $creationDt = (new \DateTimeImmutable($query[0]->creationdt));
        return response()->json(['lastupdate' => $creationDt, 'amount' => $query[0]->tussenstand]);
      }
      else
      {
        return abort(404);
      }
    }
}
