Commit iniziale

This commit is contained in:
2025-08-05 14:10:01 +02:00
commit 097b7e922d
505 changed files with 227792 additions and 0 deletions

55
app/Models/Avviso.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Http;
class Avviso extends Model
{
use HasFactory;
protected $fillable=['avviso','creato_il', 'creato_da', 'urgente'];
public static function newAvviso($data)
{
self::create([
'avviso'=>$data['avviso'],
'creato_da'=>$data['creato_da'],
'creato_il'=>date('Y-m-d'),
'urgente'=>$data['urgente'],
]);
}
public static function getAvvisi()
{
return self::all();
}
public static function getActualAvvisi()
{
return self::where('creato_il','>=', now()->subMonth())->get();
}
public static function getHAstatus()
{
/*$response = Http::withHeaders([
'Authorization'=>' Bearer '.env('HA_TOKEN'),
'Content-Type'=>' application/json',
])->get('https://ha.lavorain.cloud/api/services',['domain']);
return $response;
// return dd($response);*/
}
public static function getAnsaNews()
{
/*$xmlstring = Http::get('https://www.ansa.it/trentino/notizie/trentino_rss.xml');
$xml_file = simplexml_load_string($xmlstring);
$json = json_encode($xml_file );
$array = json_decode($json,TRUE);
dd($array); // return $array;*/
}
}