Showing AI reviews for avriti-backend
Project AI Score ?
59%
Quality Avg ?
64%
Security Avg ?
45%
Reviews ?
57

Review Result ?

jattin01/avriti-backend · 609e5689
This commit introduces several environment configuration variables, modifies database schema to store 'how_to_use' as JSON, updates backend controllers and views for better order and product management. It improves data handling and UI presentation for orders. However, it exposes sensitive information in the .env file and includes redundant session variable duplicates. The commit message is vague and does not clearly describe the changes made or their purpose.
Quality ?
65%
Security ?
10%
Business Value ?
70%
Maintainability ?
73%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Security Issue
Where .env:38
Issue / Evidence security risk
Suggested Fix remove or encrypt sensitive credentials such as DB_PASSWORD and MAIL_PASSWORD from the public commit
Redundancy
Where .env:45
Issue / Evidence redundancy
Suggested Fix remove duplicate SESSION_DRIVER and related session settings to reduce confusion
Lack Of Clarity
Where commit message
Issue / Evidence lack of clarity
Suggested Fix improve the commit message to clearly describe the changes and their intent for better maintainability
Minor Ui
Where resources/views/admin/order-detail.blade.php:62
Issue / Evidence minor UI
Suggested Fix ensure address fields render correctly to avoid concatenating empty strings or missing spacing
Robustness
Where database/migrations/2026_06_16_062125_change_how_to_use_to_json_in_products_table.php:14
Issue / Evidence robustness
Suggested Fix add error handling or validation when converting 'how_to_use' field to JSON to prevent data loss
Code Clarity
Where app/Http/Controllers/AdminOrderController.php:22
Issue / Evidence code clarity
Suggested Fix add comments explaining the purpose of eager loading customer and items to help future maintainers
Code Change Preview · .env ?
Removed / Before Commit

                                                
Added / After Commit
+ APP_NAME=Laravel
+ APP_ENV=local
+ APP_KEY=base64:YkLfLJ78zljyLuLqC2wnmybild13CNeNzhXDOGCDc4g=
+ APP_DEBUG=true
+ # APP_URL=http://localhost
+ APP_URL=https://api.digitalmission.in
+ FRONTEND_URL=https://avriti.digitalmission.in
+ # FRONTEND_URL=http://localhost:3000
+ 
+ APP_LOCALE=en
+ APP_FALLBACK_LOCALE=en
+ APP_FAKER_LOCALE=en_US
+ 
+ APP_MAINTENANCE_DRIVER=file
+ # APP_MAINTENANCE_STORE=database
+ 
+ # PHP_CLI_SERVER_WORKERS=4
+ 
Removed / Before Commit
- *.log
- .DS_Store
- .env
- .env.backup
- .env.production
- .phpactor.json
- .phpunit.result.cache
- /.fleet
Added / After Commit
+ *.log
+ .DS_Store
+ # .env
+ # .env.backup
+ # .env.production
+ .phpactor.json
+ .phpunit.result.cache
+ /.fleet
Removed / Before Commit
- 
- return view('admin.orders', compact('orders'));
- }
- }
Added / After Commit
+ 
+ return view('admin.orders', compact('orders'));
+ }
+ 
+     public function show(Order $order): View
+     {
+         $order->load(['customer', 'items']);
+ 
+         return view('admin.order-detail', compact('order'));
+     }
+ }
Removed / Before Commit
- 'attributes.*.critical_qty' => ['nullable', 'integer', 'min:0'],
- 'attributes.*.sku' => ['nullable', 'string', 'max:255'],
- 'attributes.*.in_stock' => ['nullable', 'boolean'],
-                 'how_to_use' => ['nullable', 'string'],
- 'existing_thumbnails' => ['nullable', 'array'],
- 'existing_thumbnails.*' => ['nullable', 'string'],
- 'thumbnail' => ['nullable', 'array'],
- 'short_description' => $validated['short_description'] ?? null,
- 'description' => $validated['description'] ?? null,
- 'best_for' => $this->cleanRows($validated['best_for'] ?? []),
-             'how_to_use' => $validated['how_to_use'] ?? null,
- 'includes' => $this->cleanRows($validated['includes'] ?? []),
- 'attributes' => $this->cleanAttributeRows($validated['attributes'] ?? []),
- 'thumbnail' => $this->cleanImagePaths($thumbnailPaths),
Added / After Commit
+ 'attributes.*.critical_qty' => ['nullable', 'integer', 'min:0'],
+ 'attributes.*.sku' => ['nullable', 'string', 'max:255'],
+ 'attributes.*.in_stock' => ['nullable', 'boolean'],
+                 'how_to_use' => ['nullable', 'array'],
+                 'how_to_use.*' => ['nullable', 'string', 'max:255'],
+ 'existing_thumbnails' => ['nullable', 'array'],
+ 'existing_thumbnails.*' => ['nullable', 'string'],
+ 'thumbnail' => ['nullable', 'array'],
+ 'short_description' => $validated['short_description'] ?? null,
+ 'description' => $validated['description'] ?? null,
+ 'best_for' => $this->cleanRows($validated['best_for'] ?? []),
+             'how_to_use' => $this->cleanRows($validated['how_to_use'] ?? []),
+ 'includes' => $this->cleanRows($validated['includes'] ?? []),
+ 'attributes' => $this->cleanAttributeRows($validated['attributes'] ?? []),
+ 'thumbnail' => $this->cleanImagePaths($thumbnailPaths),
Removed / Before Commit
- {
- return [
- 'best_for' => 'array',
- 'includes' => 'array',
- 'attributes' => 'array',
- 'thumbnail' => 'array',
Added / After Commit
+ {
+ return [
+ 'best_for' => 'array',
+             'how_to_use' => 'array',
+ 'includes' => 'array',
+ 'attributes' => 'array',
+ 'thumbnail' => 'array',
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Support\Facades\DB;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         DB::table('products')->whereNotNull('how_to_use')->where('how_to_use', '!=', '')->get(['id', 'how_to_use'])->each(function ($product) {
+             if (str_starts_with(trim($product->how_to_use), '[')) {
+                 return;
+             }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('title', 'Order ' . $order->order_number . ' | Avriti Dashboard')
+ @section('content')
+ 
+ @php
+   $paymentStatus = strtoupper($order->payment_status ?: 'pending');
+   $paymentStatusClasses = match ($order->payment_status) {
+     'paid' => 'bg-emerald-100 text-emerald-600',
+     'failed' => 'bg-red-100 text-red-500',
+     'refunded' => 'bg-blue-100 text-blue-500',
+     default => 'bg-amber-100 text-amber-700',
+   };
+   $orderStatus = strtoupper($order->order_status ?: 'pending');
+   $orderStatusClasses = match ($order->order_status) {
+     'delivered' => 'bg-emerald-100 text-emerald-600',
+     'cancelled' => 'bg-red-100 text-red-500',
+     'returned' => 'bg-blue-100 text-blue-500',
Removed / Before Commit
- <table id="ordersTable" data-action-column="8" class="js-data-table w-full text-sm text-left text-gray-600">
- <thead class="bg-[#0b3dba] border-b border-gray-200 text-gray-500">
- <tr>
-           <th class="px-5 py-4">
-             <input type="checkbox" class="rounded border-gray-300">
-           </th>
- <th class="px-5 py-4 font-semibold text-white">Order ID</th>
- <th class="px-5 py-4 font-semibold text-white">Customer</th>
- <th class="px-5 py-4 font-semibold text-white">Product Name</th>
- };
- @endphp
- <tr class="hover:bg-gray-50 transition">
-             <td class="px-5 py-5">
-               <input type="checkbox" class="rounded border-gray-300">
- </td>
- <td class="px-5 py-5 font-semibold text-[#0b3dba]">
- {{ $order->order_number }}
- </span>
Added / After Commit
+ <table id="ordersTable" data-action-column="8" class="js-data-table w-full text-sm text-left text-gray-600">
+ <thead class="bg-[#0b3dba] border-b border-gray-200 text-gray-500">
+ <tr>
+           <th class="px-5 py-4 font-semibold text-white">S.No</th>
+ <th class="px-5 py-4 font-semibold text-white">Order ID</th>
+ <th class="px-5 py-4 font-semibold text-white">Customer</th>
+ <th class="px-5 py-4 font-semibold text-white">Product Name</th>
+ };
+ @endphp
+ <tr class="hover:bg-gray-50 transition">
+             <td class="px-5 py-5 text-gray-600">
+               {{ $loop->iteration }}
+ </td>
+ <td class="px-5 py-5 font-semibold text-[#0b3dba]">
+ {{ $order->order_number }}
+ </span>
+ </td>
+ <td class="px-5 py-5 text-center">
Removed / Before Commit
- $variantValue = old('variant_id', $product?->variant_id);
- $bestForRows = old('best_for', $product?->best_for ?? []);
- $includeRows = old('includes', $product?->includes ?? []);
- $attributeRows = old('attributes', $product?->attributes ?? []);
- 
- if (! is_array($bestForRows)) {
- $includeRows = [];
- }
- 
- if (! is_array($attributeRows)) {
- $attributeRows = [];
- }
- $includeRows = [''];
- }
- 
- if ($attributeRows === []) {
- $attributeRows = [['name' => '', 'value' => '', 'mrp' => '', 'selling_price' => '', 'stock_qty' => '', 'critical_qty' => '', 'sku' => '', 'in_stock' => true]];
- }
Added / After Commit
+ $variantValue = old('variant_id', $product?->variant_id);
+ $bestForRows = old('best_for', $product?->best_for ?? []);
+ $includeRows = old('includes', $product?->includes ?? []);
+   $howToUseRows = old('how_to_use', $product?->how_to_use ?? []);
+ $attributeRows = old('attributes', $product?->attributes ?? []);
+ 
+ if (! is_array($bestForRows)) {
+ $includeRows = [];
+ }
+ 
+   if (! is_array($howToUseRows)) {
+     $howToUseRows = [];
+   }
+ 
+ if (! is_array($attributeRows)) {
+ $attributeRows = [];
+ }
+ $includeRows = [''];
Removed / Before Commit
- $profileData   = $profileData ?? [];
- $image         = $profileData['image'] ?? null;
- $name          = $profileData['name'] ?? '-';
- $subtitle      = $profileData['subtitle'] ?? '-';
- $location      = $profileData['location'] ?? '-';
- $email         = $profileData['email'] ?? '-';
- 
- <div class="rounded-[28px] border border-slate-200 bg-slate-50 p-6">
- <div class="space-y-4">
- <div class="flex items-center justify-between gap-4 text-sm text-slate-600">
- <span>Location</span>
- <span class="font-semibold text-slate-900">{{ $location }}</span>
Added / After Commit
+ $profileData   = $profileData ?? [];
+ $image         = $profileData['image'] ?? null;
+ $name          = $profileData['name'] ?? '-';
+   $username      = $profileData['username'] ?? '-';
+ $subtitle      = $profileData['subtitle'] ?? '-';
+ $location      = $profileData['location'] ?? '-';
+ $email         = $profileData['email'] ?? '-';
+ 
+ <div class="rounded-[28px] border border-slate-200 bg-slate-50 p-6">
+ <div class="space-y-4">
+                 <div class="flex items-center justify-between gap-4 text-sm text-slate-600">
+                   <span>Username</span>
+                   <span class="font-semibold text-slate-900">{{ $username }}</span>
+                 </div>
+ <div class="flex items-center justify-between gap-4 text-sm text-slate-600">
+ <span>Location</span>
+ <span class="font-semibold text-slate-900">{{ $location }}</span>
Removed / Before Commit
- @extends('layouts.app')
- 
- @section('title', 'Products | Avriti Dashboard')
- @section('content')
- 
- @php
- @endsection
- 
- @push('scripts')
- <script>
- (() => {
- const openModal = (modal) => {
- setTimeout(() => alert.remove(), 500);
- }, 3500);
- });
- })();
- </script>
- @endpush
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('title', 'Products | Avriti Dashboard')
+ 
+ @push('styles')
+ <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet" />
+ @endpush
+ 
+ @section('content')
+ 
+ @php
+ @endsection
+ 
+ @push('scripts')
+ <script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
+ <script>
+ (() => {
+ const openModal = (modal) => {
Removed / Before Commit
- $profileData    = [
- 'image'         => $currentProfile?->user_img ?: null,
- 'name'          => $currentProfile?->name ?: $currentUser?->username ?: '-',
- 'subtitle'      => $currentProfile?->destination ?: '-',
- 'location'      => $currentProfile?->location ?: '-',
- 'email'         => $currentUser?->email ?: '-',
Added / After Commit
+ $profileData    = [
+ 'image'         => $currentProfile?->user_img ?: null,
+ 'name'          => $currentProfile?->name ?: $currentUser?->username ?: '-',
+     'username'      => $currentUser?->username ?: '-',
+ 'subtitle'      => $currentProfile?->destination ?: '-',
+ 'location'      => $currentProfile?->location ?: '-',
+ 'email'         => $currentUser?->email ?: '-',
Removed / Before Commit
- <!-- Right: flags, icons, avatar -->
- <div class="flex items-center gap-3">
- <!-- Avatar -->
-     <div class="flex items-center gap-2 cursor-pointer">
-       @if ($headerImage)
-         <img src="{{ asset($headerImage) }}" alt="{{ $headerUser->username ?? 'User' }}" class="w-9 h-9 rounded-full border-2 border-[#0b3dba] object-cover bg-gray-100"/>
-       @else
-         <div class="w-9 h-9 rounded-full border-2 border-[#0b3dba] flex items-center justify-center bg-gray-100 text-gray-600">
-           <i class="fa-solid fa-user"></i>
- </div>
-       @endif
-       <div class="leading-tight">
-         <p class="text-sm font-semibold text-white lg:text-gray-800">{{ $headerUser->username ?? 'User' }}</p>
-         <p class="text-xs text-gray-400">{{ $headerUser->email ?? 'Master' }}</p>
- </div>
-       <svg class="w-4 h-4 text-gray-400" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M19 9l-7 7-7-7"/></svg>
- </div>
- <form method="POST" action="{{ route('logout') }}">
Added / After Commit
+ <!-- Right: flags, icons, avatar -->
+ <div class="flex items-center gap-3">
+ <!-- Avatar -->
+     <div class="relative" data-user-menu>
+       <button type="button" data-user-menu-toggle class="flex items-center gap-2 cursor-pointer">
+         @if ($headerImage)
+           <img src="{{ asset($headerImage) }}" alt="{{ $headerUser->username ?? 'User' }}" class="w-9 h-9 rounded-full border-2 border-[#0b3dba] object-cover bg-gray-100"/>
+         @else
+           <div class="w-9 h-9 rounded-full border-2 border-[#0b3dba] flex items-center justify-center bg-gray-100 text-gray-600">
+             <i class="fa-solid fa-user"></i>
+           </div>
+         @endif
+         <div class="leading-tight text-left">
+           <p class="text-sm font-semibold text-white lg:text-gray-800">{{ $headerUser->username ?? 'User' }}</p>
+           <p class="text-xs text-gray-400">{{ $headerUser->email ?? 'Master' }}</p>
+ </div>
+         <svg class="w-4 h-4 text-gray-400" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M19 9l-7 7-7-7"/></svg>
+       </button>
Removed / Before Commit
- <i class="fa-solid fa-users"></i>
- Customers List
- </a>
- 
- <a href="{{ route('profile') }}" class="flex items-center gap-3 px-3 py-2.5 rounded-xl {{ request()->routeIs('profile') ? $activeClass : $inactiveClass }}">
- <i class="fa-solid fa-address-book"></i>
- Profile
-     </a>
- 
- <a href="{{ route('orders.index') }}" class="flex items-center gap-3 px-3 py-2.5 rounded-xl {{ request()->routeIs('orders.*') ? $activeClass : $inactiveClass }}">
- <svg class="w-5 h-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
Added / After Commit
+ <i class="fa-solid fa-users"></i>
+ Customers List
+ </a>
+ <!-- 
+ <a href="{{ route('profile') }}" class="flex items-center gap-3 px-3 py-2.5 rounded-xl {{ request()->routeIs('profile') ? $activeClass : $inactiveClass }}">
+ <i class="fa-solid fa-address-book"></i>
+ Profile
+     </a> -->
+ 
+ <a href="{{ route('orders.index') }}" class="flex items-center gap-3 px-3 py-2.5 rounded-xl {{ request()->routeIs('orders.*') ? $activeClass : $inactiveClass }}">
+ <svg class="w-5 h-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
Removed / Before Commit
- Route::delete('/users/{user}', [AdminUserController::class, 'destroy'])->name('users.destroy');
- Route::view('/profile', 'admin.profile')->name('profile');
- Route::get('/orders', [AdminOrderController::class, 'index'])->name('orders.index');
- Route::view('/return-refund', 'admin.return-refund')->name('return-refund.index');
- Route::get('/product-categories', [AdminProductCategoryController::class, 'index'])->name('product-categories.index');
- Route::post('/product-categories', [AdminProductCategoryController::class, 'store'])->name('product-categories.store');
Added / After Commit
+ Route::delete('/users/{user}', [AdminUserController::class, 'destroy'])->name('users.destroy');
+ Route::view('/profile', 'admin.profile')->name('profile');
+ Route::get('/orders', [AdminOrderController::class, 'index'])->name('orders.index');
+     Route::get('/orders/{order}', [AdminOrderController::class, 'show'])->name('orders.show');
+ Route::view('/return-refund', 'admin.return-refund')->name('return-refund.index');
+ Route::get('/product-categories', [AdminProductCategoryController::class, 'index'])->name('product-categories.index');
+ Route::post('/product-categories', [AdminProductCategoryController::class, 'store'])->name('product-categories.store');