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

50
app/Models/Task.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Task extends Model
{
use HasFactory;
protected $fillable=['titolo','descrizione','creato_da','assegnato_a','creato_il','termine_il','chiuso_il','stato'];
public function getAllTasks()
{
return self::all();
}
//
public static function getTaskAssignedToUser($userid)
{
return self::where('assegnato_a',$userid)->where('termine_il','>=', now())->get();
}
//
public static function getTaskAssignedByUser($userid)
{
return self::where('creato_da',$userid)->get();
}
public static function saveTask($collection)
{
self::create(
[
'titolo' => $collection['titolo'],
'descrizione'=>$collection['descrizione'],
'creato_da'=>$collection['creato_da'],
'assegnato_a'=>$collection['assegnato_a'],
'creato_il'=>date('Y-m-d'),
'termine_il'=>$collection['termine_il'],
'stato'=>'Aperto',
]
);
}
public function todolist() {
return $this->belongsTo(Todolist::class);
}
}