fix table bug

This commit is contained in:
2026-06-04 13:48:37 +03:30
parent 62d2e15270
commit a643ba58b7
9 changed files with 238 additions and 31 deletions
@@ -16,6 +16,7 @@ use \App\Http\Controllers\Customer\FundController;
use App\Http\Controllers\Site\ReportController;
use App\Services\ConfigService;
use App\Services\ProductPriceService;
use Illuminate\Support\Facades\Schema;
class ProductController extends SuperController
@@ -46,11 +47,17 @@ class ProductController extends SuperController
->initSearch($this->search)
->select($this->select)
->export($query_table);
$query_table['auto_open_at'] = Product::selectRaw(
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_open_at)))) as avg_time'
)->value('avg_time'); $query_table['auto_close_at'] = Product::selectRaw(
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_close_at)))) as avg_time'
)->value('avg_time');
if (Schema::hasColumn((new Product)->getTable(), 'auto_open_at')) {
$query_table['auto_open_at'] = Product::selectRaw(
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_open_at)))) as avg_time'
)->value('avg_time');
}
if (Schema::hasColumn((new Product)->getTable(), 'auto_close_at')) {
$query_table['auto_close_at'] = Product::selectRaw(
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_close_at)))) as avg_time'
)->value('avg_time');
}
// $query_table['11'] = $avgDuration;
// $query_table['11'] = Product::avg('auto_open_at');