<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Yajra\DataTables\DataTables;
use Illuminate\Support\Facades\Http;
use App\DataTables\IssueDataTable;
use App\Models\Issue;
use App\Models\Config;
// use App\DataTables\ContabilitaDataTableEditor;
// use App\DataTables\ContabilitaDataTable;

class HomeController extends Controller
{
  public function home(IssueDataTable $dataTable){
    try{
      $arrayStati = json_decode(Config::getValue(Config::STATI_SEGNALAZIONI_HOME));
    }catch(\Exception $e){
      $arrayStati = [];
    }

    $collection = Issue::getCollection($arrayStati);

    return $dataTable->with(['issues' => $collection])->render('home');
  }
}
