Modificato view su dashboard inserendo i tasks

This commit is contained in:
2023-07-17 12:13:28 +02:00
parent 0050c3547e
commit 0f382d4182
4 changed files with 83 additions and 0 deletions

View File

@@ -8,4 +8,39 @@ 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)->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',
]
);
}
}