wip
This commit is contained in:
1 parent
1890b1fcc2
commit
bf48caa395
22 files changed
+510
-123
No files matched your search
@@ -4,14 +4,16 @@ namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Grapper\Sofascore\Grapper;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Strings;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\ZipFolder;
|
||||
use App\Console\Commands\Grapper\Sofascore\PlayerPerSeason;
|
||||
use App\Console\Commands\Grapper\Sofascore\Rose;
|
||||
use App\Console\Commands\Grapper\Sofascore\SendMail;
|
||||
use App\Console\Commands\Grapper\Sofascore\SettingsToLocal;
|
||||
use App\Console\Commands\Grapper\Sofascore\SqlMover;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\SofaScoreTask;
|
||||
use App\Utilities\Notice;
|
||||
use App\Utilities\ZipFolder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
ini_set('magic_quotes_runtime', false);
|
||||
|
||||
@@ -19,6 +21,10 @@ class Sofascore
|
||||
{
|
||||
public static string $storage;
|
||||
|
||||
public static string $archive_name;
|
||||
|
||||
public static string $useragent;
|
||||
|
||||
public static function switch()
|
||||
{
|
||||
$function = Nuh::$options['fun'];
|
||||
@@ -35,23 +41,32 @@ class Sofascore
|
||||
|
||||
case 3:
|
||||
self::setStorage();
|
||||
|
||||
Grapper::load();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
self::setStorage();
|
||||
ZipFolder::create(self::$storage);
|
||||
|
||||
ZipFolder::create();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
self::setStorage();
|
||||
|
||||
SendMail::run();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
self::setStorage();
|
||||
|
||||
Rose::run();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
SqlMover::run();
|
||||
break;
|
||||
|
||||
default:
|
||||
Notice::note('id not valid', 'br', 1);
|
||||
}
|
||||
@@ -61,6 +76,29 @@ class Sofascore
|
||||
{
|
||||
$task = Nuh::$options['task'];
|
||||
|
||||
self::$storage = storage_path('sofascore_data') . '/' . Strings::clean(SofaScoreTask::where('id', $task)->value('name'));
|
||||
self::$storage = storage_path('sofascore_data') . '/';
|
||||
self::$useragent = 4;
|
||||
|
||||
$storage_name = Strings::clean(SofaScoreTask::where('id', $task)->value('name')) . '/';
|
||||
|
||||
switch ($task) {
|
||||
case 1:
|
||||
self::$archive_name = Carbon::now()->subDays(3)->format('Y-m-d') . '.zip';
|
||||
self::$storage .= $storage_name;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
self::$archive_name = $storage_name . '.zip';
|
||||
self::$storage .= $storage_name;
|
||||
break;
|
||||
case 4:
|
||||
self::$archive_name = 'rosa-' . Carbon::now()->format('Y-m-d') . '.zip';
|
||||
self::$storage .= $storage_name . 'rosa-' . Carbon::now()->format('Y-m-d');
|
||||
break;
|
||||
|
||||
default:
|
||||
self::$archive_name = 'archive.zip';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ class Grapper
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$force = Nuh::$options['f'] ?? 0;
|
||||
$force = Nuh::$options['ff'] ?? 0;
|
||||
|
||||
$task_id = Nuh::$options['task'] ?? 0;
|
||||
|
||||
@@ -29,26 +29,34 @@ class Grapper
|
||||
|
||||
$days = LoadDays::load();
|
||||
|
||||
$count = 0;
|
||||
|
||||
$active_tournaments = SofaScoreTaskTournament::with('tournament')->where('sofa_score_task_id', $task_id)->where('disabled', false)->get();
|
||||
|
||||
/**
|
||||
* daily restart always
|
||||
*/
|
||||
if ($task_id == 1) SofaScoreEventGrapped::where('grapper_id', $task_id)->delete();
|
||||
/**
|
||||
* empty grapping folder
|
||||
* empty mailing text
|
||||
*/
|
||||
if ($restart) {
|
||||
|
||||
File::cleanDirectory(Sofascore::$storage);
|
||||
|
||||
SofaScoreEventGrapped::where('grapper_id', $task_id)->delete();
|
||||
|
||||
foreach ($days as $d) {
|
||||
SofaScoreTaskDay::where('grapper_id', (int) $task_id)
|
||||
->where('day', $d['day'])
|
||||
->update(['done' => 0]);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Restart grapper', 'br');
|
||||
Notice::note('Cleand task directory', 'b');
|
||||
Notice::note('Flush table SofaScoreEventGrapped for task', 'b');
|
||||
Notice::note('reset grapper', 'br', 1);
|
||||
}
|
||||
} else {
|
||||
if ($debug) {
|
||||
Notice::note('Continuing grapper', 'bg');
|
||||
Notice::note('continuing grapper', 'bg');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +69,7 @@ class Grapper
|
||||
$day = $d['day'];
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Start ' . $tournament->tournament->name, 'b');
|
||||
Notice::note('START ' . $tournament->tournament->name, 'p');
|
||||
}
|
||||
|
||||
$res = SofaScoreDayTournament::whereDate('day', '=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first();
|
||||
@@ -86,6 +94,8 @@ class Grapper
|
||||
|
||||
foreach ($data['events'] as $event) {
|
||||
|
||||
Sofascore::$useragent = rand(1, 6);
|
||||
|
||||
if (!$force && SofaScoreEventGrapped::where('id', (int) $event['id'])->exists()) {
|
||||
if ($debug) {
|
||||
Notice::note('Grapped ' . $day . ' - ' . $event['homeTeam']['name'] . ' vs ' . $event['awayTeam']['name'], 'g');
|
||||
@@ -114,7 +124,7 @@ class Grapper
|
||||
$grapped->url = $url;
|
||||
$grapped->starttime = $starttime->toDateTimeString();
|
||||
|
||||
$folder = Sofascore::$storage . '/' . $day . '/' . $event['tournament']['slug'] . '/' . $event['slug'];
|
||||
$folder = Sofascore::$storage . '/' . $day . '/' . $day . '-' . $event['tournament']['slug'] . '/' . $event['slug'];
|
||||
|
||||
File::makeDirectory($folder, 0775, true, true);
|
||||
|
||||
@@ -219,7 +229,14 @@ class Grapper
|
||||
'done' => 1,
|
||||
]);
|
||||
|
||||
Notice::note('DAY DONE', 'br', 1);
|
||||
$count++;
|
||||
|
||||
Notice::note($count . ' DAYS DONE', 'bb');
|
||||
|
||||
// if ($count > 20)
|
||||
// Notice::note($count . ' DAYS DONE', 'br', 1);
|
||||
// else
|
||||
// Notice::note($count . ' DAYS DONE', 'bb');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
use App\Utilities\Notice;
|
||||
use App\Console\Commands\Nuh;
|
||||
|
||||
@@ -10,7 +11,7 @@ class CurlSofa
|
||||
{
|
||||
|
||||
public static $testfile = '/Console/Commands/Grapper/Sofascore/test/';
|
||||
|
||||
|
||||
public static function load(string $url)
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
@@ -32,8 +33,20 @@ class CurlSofa
|
||||
return json_decode($data, true);
|
||||
}
|
||||
|
||||
$useragents = [];
|
||||
$useragents[1] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15';
|
||||
$useragents[2] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3.1 Safari/605.1.15';
|
||||
$useragents[3] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36';
|
||||
$useragents[4] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.1 Safari/605.1.15';
|
||||
$useragents[5] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0';
|
||||
$useragents[6] = 'Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36';
|
||||
|
||||
// if ($debug) {
|
||||
// Notice::note($useragents[Sofascore::$useragent], 'b');
|
||||
// }
|
||||
|
||||
$headers = [
|
||||
'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:139.0) Gecko/20100101 Firefox/139.0',
|
||||
'User-Agent: ' . $useragents[Sofascore::$useragent],
|
||||
'Accept: */*',
|
||||
'Accept-Language: de,en-US;q=0.7,en;q=0.3',
|
||||
'Accept-Encoding: gzip, deflate, br, zstd',
|
||||
|
||||
@@ -94,7 +94,7 @@ class LoadDays
|
||||
}
|
||||
|
||||
if (! $dates) {
|
||||
Notice::note(__FILE__ . PHP_EOL . 'no dates', 'r', 1);
|
||||
Notice::note('NO DATES OR ALL GRAPPED', 'br', 1);
|
||||
}
|
||||
|
||||
// remove when element in array is double (day and slug)
|
||||
|
||||
+7
-6
@@ -1,30 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Utilities;
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use ZipArchive;
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
class ZipFolder
|
||||
{
|
||||
public static function create(string $path)
|
||||
public static function create()
|
||||
{
|
||||
|
||||
$zipFilePath = $path . '/archive.zip';
|
||||
$zipFilePath = Sofascore::$storage . Sofascore::$archive_name;
|
||||
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) {
|
||||
|
||||
if (is_dir($path)) {
|
||||
if (is_dir(Sofascore::$storage)) {
|
||||
|
||||
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
|
||||
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(Sofascore::$storage));
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (!$file->isDir()) {
|
||||
$filePath = $file->getRealPath();
|
||||
$relativePath = substr($filePath, strlen($path) + 1);
|
||||
$relativePath = substr($filePath, strlen(Sofascore::$storage) + 1);
|
||||
$zip->addFile($filePath, $relativePath);
|
||||
}
|
||||
}
|
||||
@@ -4,31 +4,56 @@ namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\LoadDays;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Strings;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\SofaScoreDayTournament;
|
||||
use App\Models\SofaScoreEventGrapped;
|
||||
use App\Models\SofaScoreTaskDay;
|
||||
use App\Models\SofaScoreTaskTournament;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class Rose
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
File::makeDirectory(Sofascore::$storage, 0775, true, true);
|
||||
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$task_id = Nuh::$options['task'] ?? 0;
|
||||
$restart = Nuh::$options['restart'] ?? 0;
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/team/4937/players";
|
||||
if ($restart) {
|
||||
SofaScoreRosa::query()->update(['grapped' => 0]);
|
||||
if ($debug) {
|
||||
Notice::note('Restart rosa grapper', 'b');
|
||||
}
|
||||
} else {
|
||||
if ($debug) {
|
||||
Notice::note('continuing grapping', 'bg');
|
||||
}
|
||||
}
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
$res = SofaScoreRosa::where('id', '>', 441)->get();
|
||||
|
||||
dd($data);
|
||||
foreach ($res as $value) {
|
||||
|
||||
$url = Nuh::$options['base_url'] . 'api/v1/team/' . $value->ssteam_id . '/players';
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
/*********************************
|
||||
* add team to folder
|
||||
*********************************/
|
||||
|
||||
File::put(Sofascore::$storage . '/' . Strings::clean($value->ssteam_name) . '.json', json_encode($data));
|
||||
|
||||
SofaScoreRosa::where('id', $value->id)->update(['grapped' => 1]);
|
||||
|
||||
|
||||
if (rand(0, 1))
|
||||
Sleeper::rand(1);
|
||||
else
|
||||
Sleeper::rand(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,15 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\LoadDays;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Mail\SofaScoreDataMail;
|
||||
use App\Models\SofaScoreEventGrapped;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
use App\Models\SofaScoreTask;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SendMail
|
||||
{
|
||||
@@ -17,26 +18,29 @@ class SendMail
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$days = LoadDays::load();
|
||||
$task_id = Nuh::$options['task'] ?? 0;
|
||||
|
||||
foreach ($days as $d) {
|
||||
$task = SofaScoreTask::where('id', $task_id)->first();
|
||||
|
||||
$day = $d['day'];
|
||||
$zip_file = Sofascore::$storage . Sofascore::$archive_name;
|
||||
|
||||
$message = self::createMailText($day);
|
||||
$header = self::createHeader($task);
|
||||
|
||||
$zip_file = Sofascore::$storage . '/' . $day . '.zip';
|
||||
$message = self::createMessage($task);
|
||||
|
||||
if (File::exists($zip_file)) {
|
||||
if (File::exists($zip_file)) {
|
||||
|
||||
Mail::to('hermann.telser@gmail.com')
|
||||
->cc('ubaldo.perrucci@gmail.com')
|
||||
->send(
|
||||
new SofaScoreDataMail($day, $message, $zip_file)
|
||||
);
|
||||
if ($debug) {
|
||||
Notice::note('Mail send' . $day);
|
||||
}
|
||||
Mail::to('hermann.telser@gmail.com')
|
||||
// ->cc('ubaldo.perrucci@gmail.com')
|
||||
->send(
|
||||
new SofaScoreDataMail($header, $message)
|
||||
);
|
||||
if ($debug) {
|
||||
Notice::note('Mail: ' . $header);
|
||||
}
|
||||
} else {
|
||||
if ($debug) {
|
||||
Notice::note('zip not found ' . $zip_file, 'r', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,15 +49,41 @@ class SendMail
|
||||
}
|
||||
}
|
||||
|
||||
public static function createMailText(string $day)
|
||||
public static function createMessage(SofaScoreTask $task)
|
||||
{
|
||||
$res = SofaScoreEventGrapped::where('day', $day)->get();
|
||||
$text = "## Mail Content $day
|
||||
";
|
||||
$res = SofaScoreEventGrapped::where('grapper_id', $task->id)->get();
|
||||
|
||||
$text = '
|
||||
|
||||
';
|
||||
|
||||
foreach ($res as $value) {
|
||||
$text .= "### $value->liga * $value->name * $value->starttime
|
||||
";
|
||||
$text .= $value->liga . ' - ' . $value->name . ' - ' . $value->starttime;
|
||||
$text .= '
|
||||
';
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
public static function createHeader(SofaScoreTask $task)
|
||||
{
|
||||
$text = "## ";
|
||||
switch ($task->mode) {
|
||||
case 'daily':
|
||||
$text = $task->name . ' - ' . Carbon::now()->subDays(3)->format('Y-m-d');
|
||||
break;
|
||||
case 'date':
|
||||
$text = $task->name . ' - ' . $task->day_from;
|
||||
break;
|
||||
case 'range':
|
||||
$text = $task->name . ' - ' . $task->day_from . ' - ' . $task->day_to;
|
||||
break;
|
||||
|
||||
default:
|
||||
$text = $task->name;
|
||||
break;
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
@@ -19,18 +19,27 @@ class SettingsToLocal
|
||||
Notice::note('Settings To Local', 'bb');
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('SofaScoreTask', 'g');
|
||||
}
|
||||
SofaScoreTask::truncate();
|
||||
$rows = DB::connection('remote_mariadb')->table('sofa_score_tasks')->get();
|
||||
foreach ($rows as $row) {
|
||||
SofaScoreTask::insert((array) $row);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('SofaScoreTaskTournament', 'g');
|
||||
}
|
||||
SofaScoreTaskTournament::truncate();
|
||||
$rows = DB::connection('remote_mariadb')->table('sofa_score_task_tournaments')->get();
|
||||
foreach ($rows as $row) {
|
||||
SofaScoreTaskTournament::insert((array) $row);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('SofaScoreRosa', 'g');
|
||||
}
|
||||
SofaScoreRosa::truncate();
|
||||
$rows = DB::connection('remote_mariadb')->table('sofa_score_rosas')->get();
|
||||
foreach ($rows as $row) {
|
||||
|
||||
@@ -2,21 +2,27 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Models\SofaScoreTaskTournament;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class SqlMover
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
// $ligas = [649, 242, 20, 40, 325, 41];
|
||||
$ligas = [5, 9, 19, 26, 13, 99];
|
||||
|
||||
$res = SofaScoreTaskTournament::get();
|
||||
Notice::note('SqlMover', 'b');
|
||||
|
||||
foreach ($res as $value) {
|
||||
$res2 = SofaScoreTournament::where('tournament_id', $value->sofa_score_tournament_id)->first();
|
||||
foreach ($ligas as $liga_id) {
|
||||
|
||||
SofaScoreTaskTournament::where('id', $value->id)->update(['sofa_score_category_id' => $res2->sofa_score_category_id]);
|
||||
$res = StatistikoEvent::where('league_id', $liga_id)->pluck('match_id');
|
||||
|
||||
dd($res);
|
||||
|
||||
foreach ($res as $match_id) {
|
||||
dd($match_id);
|
||||
}
|
||||
}
|
||||
|
||||
Notice::note('done', 'bb', 1);
|
||||
|
||||
@@ -25,7 +25,9 @@ class Groups
|
||||
|
||||
foreach ($kontos as $konto => $authentication) {
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/groups.php?'.$authentication.'&sid='.implode(',', $years);
|
||||
$url = 'https://xml2.txodds.com/feed/groups.php?' . $authentication . '&sid=' . implode(',', $years);
|
||||
|
||||
// https://xml2.txodds.com/feed/groups.php?ident=betaid1&passwd=Dy59vpRC&sid=25
|
||||
|
||||
// <group>
|
||||
// <id>181996</id>
|
||||
|
||||
@@ -23,7 +23,7 @@ class Nuh extends Command
|
||||
|
||||
public static $id = 0;
|
||||
|
||||
protected $signature = 'nuh {process=help} {--truncate} {--id=0} {--fun=} {--task=0} {--restart=0} {--gid=} {--p} {--d} {--x} {--t} {--y} {--m} {--l} {--w} {--a} {--r} {--s} {--g} {--t} {--q} {--f} {--b} {--e} {--z}';
|
||||
protected $signature = 'nuh {process=help} {--truncate} {--id=0} {--fun=} {--ff} {--task=0} {--restart=0} {--gid=} {--p} {--d} {--x} {--t} {--y} {--m} {--l} {--w} {--a} {--r} {--s} {--g} {--t} {--q} {--f} {--b} {--e} {--z}';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
@@ -64,6 +64,7 @@ class Nuh extends Command
|
||||
$txt .= '--d debug' . PHP_EOL;
|
||||
$txt .= '--e echo client data' . PHP_EOL;
|
||||
$txt .= '--f force (what ever in script)' . PHP_EOL;
|
||||
$txt .= '--ff force grapping (sofascore)' . PHP_EOL;
|
||||
$txt .= '--g by minor groups (tx)' . PHP_EOL;
|
||||
$txt .= '--t load today' . PHP_EOL;
|
||||
$txt .= '--m mail it' . PHP_EOL;
|
||||
|
||||
+1
-1
@@ -8,7 +8,6 @@ use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
@@ -22,6 +21,7 @@ class SofaScoreRosasTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->description('The squad for the team selected will be send next day via mail. The selection will be unset after sending.')
|
||||
->columns([
|
||||
TextColumn::make('ssteam_id')->label('Id')->badge()->width('1rem'),
|
||||
TextColumn::make('country.name')->label('Country'),
|
||||
|
||||
+4
-1
@@ -20,6 +20,7 @@ use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
@@ -71,6 +72,7 @@ class SofaScoreTaskTournamentsRelationManager extends RelationManager
|
||||
TextColumn::make('category.name')
|
||||
->label('Category')
|
||||
->searchable(),
|
||||
TextColumn::make('tournament.tournament_id'),
|
||||
TextColumn::make('tournament.name')
|
||||
->weight(FontWeight::Bold)
|
||||
->searchable(),
|
||||
@@ -88,7 +90,8 @@ class SofaScoreTaskTournamentsRelationManager extends RelationManager
|
||||
->pluck('sofa_score_category_id')
|
||||
->toArray();
|
||||
return SofaScoreCategory::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
}),
|
||||
TernaryFilter::make('disabled'),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->headerActions([
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
class SofaScoreDataMail extends Mailable
|
||||
{
|
||||
@@ -16,11 +17,12 @@ class SofaScoreDataMail extends Mailable
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct(string $day, string $message, string $zip_file)
|
||||
public function __construct(string $header, string $message)
|
||||
{
|
||||
$this->day = $day;
|
||||
$this->header = $header;
|
||||
$this->message = $message;
|
||||
$this->zip_file = $zip_file;
|
||||
$this->archive_name = Sofascore::$archive_name;
|
||||
$this->zip_file = Sofascore::$storage . Sofascore::$archive_name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,7 +31,7 @@ class SofaScoreDataMail extends Mailable
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Sofa Score ' . $this->day,
|
||||
subject: $this->header,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,7 +57,7 @@ class SofaScoreDataMail extends Mailable
|
||||
{
|
||||
return [
|
||||
Attachment::fromPath($this->zip_file)
|
||||
->as('sofa archive ' . $this->day . '.zip')
|
||||
->as($this->archive_name)
|
||||
->withMime('application/x-zip-compressed')
|
||||
];
|
||||
}
|
||||
|
||||
@@ -4,18 +4,27 @@ namespace App\Utilities;
|
||||
|
||||
class Notice
|
||||
{
|
||||
// note
|
||||
/**
|
||||
* \e[1;30m Black
|
||||
* \e[1;31m Red
|
||||
* \e[1;32m Green
|
||||
* \e[1;33m Yellow
|
||||
* \e[1;34m Blue
|
||||
* \e[1;35m Purple
|
||||
* \e[1;36m Cyan
|
||||
* \e[1;37m White
|
||||
*/
|
||||
|
||||
public static function db($message, $exit = false)
|
||||
{
|
||||
echo "\e[0;35m";
|
||||
echo PHP_EOL.'-----------------------------------------------------------'.PHP_EOL;
|
||||
echo PHP_EOL . '-----------------------------------------------------------' . PHP_EOL;
|
||||
if (is_array($message)) {
|
||||
print_r($message);
|
||||
} else {
|
||||
echo $message.PHP_EOL;
|
||||
echo $message . PHP_EOL;
|
||||
}
|
||||
echo '-----------------------------------------------------------'.PHP_EOL;
|
||||
echo '-----------------------------------------------------------' . PHP_EOL;
|
||||
echo "\e[0;39m";
|
||||
if ($exit) {
|
||||
exit();
|
||||
@@ -72,13 +81,13 @@ class Notice
|
||||
break;
|
||||
}
|
||||
|
||||
echo PHP_EOL.'-----------------------------------------------------------'.PHP_EOL;
|
||||
echo PHP_EOL . '-----------------------------------------------------------' . PHP_EOL;
|
||||
if (is_array($message)) {
|
||||
print_r($message);
|
||||
} else {
|
||||
echo $message.PHP_EOL;
|
||||
echo $message . PHP_EOL;
|
||||
}
|
||||
echo '-----------------------------------------------------------'.PHP_EOL;
|
||||
echo '-----------------------------------------------------------' . PHP_EOL;
|
||||
echo "\e[0;39m";
|
||||
if ($exit) {
|
||||
exit();
|
||||
|
||||
Reference in new issue
Block a user