fix(tahesab): do not 500 pending-summary when tahesab table is missing

Gholaktala has no local tahesab table; count queries now return empty pending stats instead of QueryException.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-02 21:00:22 +03:30
co-authored by Cursor
parent c5fd3b45fe
commit ad12de87c7
2 changed files with 38 additions and 3 deletions
@@ -8,6 +8,7 @@ use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Schema;
use App\Models\Tahesab;
use App\Models\Customer;
use App\Services\AccountingProductDocMapper;
@@ -44,6 +45,10 @@ class TahesabController extends Controller
public function table(Request $request)
{
if (! Schema::hasTable('tahesab')) {
return response()->json([]);
}
$view = (string) $request->input('view', 'all');
$query = Tahesab::with('customer')->orderByDesc('id');