This commit is contained in:
salam committed 2026-09-28 08:19:49 +02:00
1 parent 254ca94d73
commit eb4499efe5
5 files changed
+22 -22

No files matched your search

+14 -9
View File
@@ -2,8 +2,8 @@
namespace App\Traits\Sofascore;
use App\Models\SofaScoreTask;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
@@ -21,14 +21,19 @@ trait GrappingToExcel
Notice::note("import $folder to excel", 'g');
}
$this->titel = ucfirst($folder);
if (! $day) {
$this->titel .= '_'.Carbon::now()->format('Y-m-d');
} else {
$this->titel .= "_$day";
}
switch ($this->task_id) {
case 1:
$this->titel .= ucfirst($folder).'_'.$day;
$files = $this->get_tree($this->data_dir);
$files = $this->get_tree($this->data_dir.'/'.$day);
break;
case 3:
$task = SofaScoreTask::with('sport')->where('id', $this->task_id)->first();
$this->titel = ucfirst($folder).'-'.$this->clean_string($task->name);
$files = $this->get_tree($this->data_dir);
break;
}
$files = array_chunk($this->filter($files), $this->max);
@@ -74,7 +79,7 @@ trait GrappingToExcel
$spreadsheet->setActiveSheetIndex(0);
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save("$this->data_dir/$folder/$this->titel-$count_from-$count_to.xlsx");
$writer->save("$this->data_dir/$this->titel-$count_from-$count_to.xlsx");
}
}