category qosishsh to'g'irlandi

This commit is contained in:
2026-04-29 13:44:37 +05:00
parent e1f79a58ec
commit 92227fd5f0
3 changed files with 25 additions and 7 deletions

View File

@@ -24,11 +24,12 @@ use App\Jobs\Dashboard\Product\Child as ChildJob;
use App\Jobs\Dashboard\Product\ChildUpdate as ChildUpdateJob;
use App\Jobs\Dashboard\Product\Update as UpdateJob;
use App\Jobs\Dashboard\Product\Deletes as DeletesJob;
use Exception;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
use Throwable;
class Controller extends ExController
{
@@ -97,10 +98,17 @@ class Controller extends ExController
$this->charSync($product, $request->characteristics);
$this->dispatchSync(new ChildJob($request, $product));
} catch (Exception $e) {
} catch (Throwable $e) {
Log::error('Product store failed', [
'message' => $e->getMessage(),
'category_id' => $request->get('category_id'),
'trace' => $e->getTraceAsString(),
]);
return Response::json([
'status' => false,
'messages' => $e->getMessage()
'messages' => 'Product could not be saved.',
'error' => config('app.debug') ? $e->getMessage() : null,
], 500);
}
@@ -341,10 +349,18 @@ class Controller extends ExController
$this->dispatchSync(new ChildUpdateJob($request, $product));
$this->charSync($product, $request->characteristics);
$this->dispatchSync(new DeletesJob($request));
} catch (Exception $e) {
} catch (Throwable $e) {
Log::error('Product update failed', [
'product_id' => $product->id,
'message' => $e->getMessage(),
'category_id' => $request->get('category_id'),
'trace' => $e->getTraceAsString(),
]);
return Response::json([
'status' => false,
'messages' => $e->getMessage()
'messages' => 'Product could not be saved.',
'error' => config('app.debug') ? $e->getMessage() : null,
], 500);
}