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

Review Result ?

jattin01/avriti-backend · dad906bb
The commit adds backend controllers for product categories and products including CRUD operations and some validation for uniqueness of slugs and presence of associated records. The code is generally well organized and covers typical product management features. However, there is only partial input validation visible and some risk around ensuring thumbnails management is robust. The commit message is vague and does not clearly explain the scope or individual features added. Security measures like validation and unique slug checks are present but could be stronger. No explicit authentication or authorization checks are shown in the diff.
Quality ?
85%
Security ?
70%
Business Value ?
80%
Maintainability ?
83%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Vague And Low Detail
Where commit message
Issue / Evidence vague and low detail
Suggested Fix improve clarity by summarizing key features and scope of changes in message
Duplicate Logic
Where app/Http/Controllers/AdminProductController.php:63
Issue / Evidence merging thumbnails arrays without deduplication
Suggested Fix add deduplication or validation to avoid duplicated files
Missing Validation
Where app/Http/Controllers/AdminProductCategoryController.php:100
Issue / Evidence ValidationException with static message for slug uniqueness
Suggested Fix consider adding more context or localization support
Missing Validation
Where app/Http/Controllers/AdminProductController.php:91
Issue / Evidence relies on existence validation for foreign keys but no authorization checks
Suggested Fix add authorization to protect endpoints
No Explicit Try Catch Or Error Logging
Where app/Http/Controllers/AdminProductCategoryController.php:26
Issue / Evidence no explicit try-catch or error logging
Suggested Fix consider adding error handling to improve debugging and error transparency
Code Change Preview · app/Http/Controllers/AdminProductCategoryController.php ?
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\ProductCategory;
+ use Illuminate\Http\RedirectResponse;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Str;
+ use Illuminate\Validation\ValidationException;
+ use Illuminate\View\View;
+ 
+ class AdminProductCategoryController extends Controller
+ {
+     public function index(): View
+     {
+         $categories = ProductCategory::query()
+             ->latest()
+             ->get();
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\Product;
+ use App\Models\ProductCategory;
+ use App\Models\ProductType;
+ use App\Models\Variant;
+ use Illuminate\Http\RedirectResponse;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\File;
+ use Illuminate\Support\Str;
+ use Illuminate\Validation\ValidationException;
+ use Illuminate\View\View;
+ 
+ class AdminProductController extends Controller
+ {
+     public function index(): View
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\ProductType;
+ use Illuminate\Http\RedirectResponse;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Str;
+ use Illuminate\Validation\ValidationException;
+ use Illuminate\View\View;
+ 
+ class AdminProductTypeController extends Controller
+ {
+     public function index(): View
+     {
+         $types = ProductType::query()
+             ->latest()
+             ->get();
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\User;
+ use Illuminate\Http\RedirectResponse;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\File;
+ use Illuminate\Validation\Rule;
+ use Illuminate\View\View;
+ 
+ class AdminUserController extends Controller
+ {
+     public function index(Request $request): View
+     {
+         $filter = trim((string) $request->query('filter', ''));
+ 
+         $users = User::query()
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\Variant;
+ use Illuminate\Http\RedirectResponse;
+ use Illuminate\Http\Request;
+ use Illuminate\View\View;
+ 
+ class AdminVariantController extends Controller
+ {
+     public function index(): View
+     {
+         $variants = Variant::query()
+             ->latest()
+             ->get();
+ 
+         return view('admin.variants', [
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\User;
+ use Illuminate\Http\JsonResponse;
+ use Illuminate\Http\RedirectResponse;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\Auth;
+ use Illuminate\Support\Facades\Hash;
+ use Illuminate\Validation\ValidationException;
+ use Illuminate\View\View;
+ 
+ class AuthController extends Controller
+ {
+     public function showLogin(): View
+     {
+         return view('auth.login');
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ use Illuminate\Database\Eloquent\Relations\BelongsTo;
+ 
+ class Product extends Model
+ {
+     use HasFactory;
+ 
+     protected $fillable = [
+         'category_id',
+         'product_type_id',
+         'variant_id',
+         'title',
+         'slug',
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class ProductCategory extends Model
+ {
+     use HasFactory;
+ 
+     protected $fillable = [
+         'name',
+         'slug',
+         'description',
+         'is_active',
+     ];
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class ProductType extends Model
+ {
+     use HasFactory;
+ 
+     protected $fillable = [
+         'name',
+         'slug',
+         'is_active',
+     ];
+ 
+     protected function casts(): array
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ use Illuminate\Database\Eloquent\Relations\BelongsTo;
+ 
+ class Profile extends Model
+ {
+     /**
+      * The attributes that are mass assignable.
+      *
+      * @var list<string>
+      */
+     protected $fillable = [
+         'user_id',
+         'user_img',
+         'name',
Removed / Before Commit
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Illuminate\Notifications\Notifiable;
- 
- class User extends Authenticatable
- {
- /** @use HasFactory<UserFactory> */
-     use HasFactory, Notifiable;
- 
- /**
- * The attributes that are mass assignable.
- *
- * @var list<string>
- */
- protected $fillable = [
-         'name',
- 'email',
- 'password',
Added / After Commit
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Foundation\Auth\User as Authenticatable;
+ use Illuminate\Notifications\Notifiable;
+ use Illuminate\Database\Eloquent\Relations\HasOne;
+ use Laravel\Sanctum\HasApiTokens;
+ 
+ class User extends Authenticatable
+ {
+ /** @use HasFactory<UserFactory> */
+     use HasApiTokens, HasFactory, Notifiable;
+ 
+ /**
+ * The attributes that are mass assignable.
+ *
+ * @var list<string>
+ */
+ protected $fillable = [
+         'username',
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class Variant extends Model
+ {
+     use HasFactory;
+ 
+     protected $fillable = [
+         'name',
+         'unit',
+         'is_active',
+     ];
+ 
+     protected function casts(): array
Removed / Before Commit
- return Application::configure(basePath: dirname(__DIR__))
- ->withRouting(
- web: __DIR__.'/../routes/web.php',
- commands: __DIR__.'/../routes/console.php',
- health: '/up',
- )
Added / After Commit
+ return Application::configure(basePath: dirname(__DIR__))
+ ->withRouting(
+ web: __DIR__.'/../routes/web.php',
+         api: __DIR__.'/../routes/api.php',
+ commands: __DIR__.'/../routes/console.php',
+ health: '/up',
+ )
Removed / Before Commit
- "require": {
- "php": "^8.2",
- "laravel/framework": "^12.0",
- "laravel/tinker": "^2.10.1"
- },
- "require-dev": {
Added / After Commit
+ "require": {
+ "php": "^8.2",
+ "laravel/framework": "^12.0",
+         "laravel/sanctum": "^4.3",
+ "laravel/tinker": "^2.10.1"
+ },
+ "require-dev": {
Removed / Before Commit
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
- "This file is @generated automatically"
- ],
-     "content-hash": "53b5d56b3b7e3cbac1713e68c8850f6c",
- "packages": [
- {
- "name": "brick/math",
- },
- "time": "2026-05-19T00:47:18+00:00"
- },
- {
- "name": "laravel/serializable-closure",
- "version": "v2.0.13",
Added / After Commit
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+     "content-hash": "f4dbe09ac5bbddf1a0ad59af35d90a39",
+ "packages": [
+ {
+ "name": "brick/math",
+ },
+ "time": "2026-05-19T00:47:18+00:00"
+ },
+         {
+             "name": "laravel/sanctum",
+             "version": "v4.3.2",
+             "source": {
+                 "type": "git",
+                 "url": "https://github.com/laravel/sanctum.git",
+                 "reference": "2a9bccc18e9907808e0018dd15fa643937886b1e"
+             },
Removed / Before Commit
- public function definition(): array
- {
- return [
-             'name' => fake()->name(),
- 'email' => fake()->unique()->safeEmail(),
- 'email_verified_at' => now(),
- 'password' => static::$password ??= Hash::make('password'),
- 'remember_token' => Str::random(10),
- ];
- }
- 
- /**
- * Indicate that the model's email address should be unverified.
- */
Added / After Commit
+ public function definition(): array
+ {
+ return [
+             'username' => fake()->unique()->userName(),
+ 'email' => fake()->unique()->safeEmail(),
+ 'email_verified_at' => now(),
+ 'password' => static::$password ??= Hash::make('password'),
+ 'remember_token' => Str::random(10),
+ ];
+ }
+ 
+     /**
+      * Configure the model factory.
+      */
+     public function configure(): static
+     {
+         return $this->afterCreating(function (User $user): void {
+             $user->profile()->create([
Removed / Before Commit
- {
- Schema::create('users', function (Blueprint $table) {
- $table->id();
-             $table->string('name');
- $table->string('email')->unique();
- $table->timestamp('email_verified_at')->nullable();
- $table->string('password');
Added / After Commit
+ {
+ Schema::create('users', function (Blueprint $table) {
+ $table->id();
+            
+             $table->string('username')->unique();
+ $table->string('email')->unique();
+ $table->timestamp('email_verified_at')->nullable();
+ $table->string('password');
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::table('users', function (Blueprint $table) {
+             $table->string('name')->nullable();
+             $table->string('phone_number')->nullable();
+             $table->string('destination')->nullable();
+             $table->string('location')->nullable();
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::create('personal_access_tokens', function (Blueprint $table) {
+             $table->id();
+             $table->morphs('tokenable');
+             $table->text('name');
+             $table->string('token', 64)->unique();
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\DB;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::create('profiles', function (Blueprint $table) {
+             $table->id();
+             $table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
+             $table->string('name')->nullable();
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\DB;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::table('users', function (Blueprint $table) {
+             $table->boolean('is_active')->default(true)->after('password');
+         });
+ 
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         Schema::create('product_categories', function (Blueprint $table) {
+             $table->id();
+             $table->string('name');
+             $table->string('slug')->unique();
+             $table->text('description')->nullable();
+             $table->boolean('is_active')->default(true);
+             $table->timestamps();
+         });
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::create('product_types', function (Blueprint $table) {
+         $table->id();
+         $table->string('name');
+         $table->string('slug')->unique();
+         $table->boolean('is_active')->default(true);
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::create('variants', function (Blueprint $table) {
+             $table->id();
+             $table->string('name');
+             $table->string('unit')->nullable();
+             $table->boolean('is_active')->default(true);
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::create('products', function (Blueprint $table) {
+             $table->id();
+             $table->foreignId('category_id')->constrained('product_categories')->onDelete('cascade');
+             $table->foreignId('product_type_id')->constrained('product_types')->onDelete('cascade');
+             $table->string('title');
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         if (Schema::hasColumn('products', 'variant_id')) {
+             return;
+         }
+ 
+         Schema::table('products', function (Blueprint $table): void {
+             $table
+                 ->foreignId('variant_id')
+                 ->nullable()
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         if (Schema::hasColumn('products', 'attributes')) {
+             return;
+         }
+ 
+         Schema::table('products', function (Blueprint $table): void {
+             $table->json('attributes')->nullable()->after('includes');
+         });
+     }
Removed / Before Commit
- {
- // User::factory(10)->create();
- 
-         User::factory()->create([
-             'name' => 'Test User',
- 'email' => 'test@example.com',
- ]);
- }
- }
Added / After Commit
+ {
+ // User::factory(10)->create();
+ 
+         $user = User::factory()->create([
+             'username' => 'testuser',
+ 'email' => 'test@example.com',
+ ]);
+ 
+         $user->profile()->update([
+             'name' => 'Test User',
+         ]);
+ }
+ }
Removed / Before Commit

                                                
Added / After Commit
+ 
Removed / Before Commit

                                                
Added / After Commit
+ 
Removed / Before Commit

                                                
Added / After Commit
+ @php
+   $statusValue = (string) old('is_active', $category ? (int) $category->is_active : 1);
+ @endphp
+ 
+ <div class="grid gap-6 p-6 lg:grid-cols-2">
+   <div>
+     <label class="block text-sm font-semibold text-gray-700 mb-2">Name</label>
+     <input
+       type="text"
+       name="name"
+       value="{{ old('name', $category?->name) }}"
+       class="w-full h-12 px-4 border border-gray-300 rounded-md outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent" />
+     @error('name')
+       <p class="mt-2 text-xs font-medium text-red-500">{{ $message }}</p>
+     @enderror
+   </div>
+ 
+   <div>
Removed / Before Commit

                                                
Added / After Commit
+ @php
+   $categoryValue = old('category_id', $product?->category_id);
+   $typeValue = old('product_type_id', $product?->product_type_id);
+   $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)) {
+     $bestForRows = [];
+   }
+ 
+   if (! is_array($includeRows)) {
+     $includeRows = [];
+   }
+ 
+   if (! is_array($attributeRows)) {
+     $attributeRows = [];
Removed / Before Commit

                                                
Added / After Commit
+ @php
+   $statusValue = (string) old('is_active', $type ? (int) $type->is_active : 1);
+ @endphp
+ 
+ <div class="grid gap-6 p-6 lg:grid-cols-2">
+   <div>
+     <label class="block text-sm font-semibold text-gray-700 mb-2">Name</label>
+     <input
+       type="text"
+       name="name"
+       value="{{ old('name', $type?->name) }}"
+       class="w-full h-12 px-4 border border-gray-300 rounded-md outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent" />
+     @error('name')
+       <p class="mt-2 text-xs font-medium text-red-500">{{ $message }}</p>
+     @enderror
+   </div>
+ 
+   <div>
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ @php
+ $statusValue = (string) old('is_active', $variant ? (int) $variant->is_active : 1);
+ @endphp
+ 
+ <div class="grid gap-6 p-6 lg:grid-cols-2 ">
+   <div>
+     <label class="block text-sm font-semibold text-gray-700 mb-2">Name</label>
+     <input
+       type="text"
+       name="name"
+       value="{{ old('name', $variant?->name) }}"
+       class="w-full h-12 px-4 border border-gray-300 rounded-md outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent" />
+     @error('name')
+     <p class="mt-2 text-xs font-medium text-red-500">{{ $message }}</p>
+     @enderror
+   </div>
+ 
+   <input type="hidden" name="unit" value="{{ old('unit', $variant?->unit) }}" />
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('title', 'Product Categories | Avriti Dashboard')
+ @section('content')
+ 
+ @php
+   $openModal = old('_modal');
+ @endphp
+ 
+ <div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
+   <div>
+     <h1 class="text-2xl font-semibold text-[#0b3dba]">Product Categories</h1>
+   </div>
+   <button type="button" data-modal-target="createCategoryModal" class="inline-flex h-11 items-center justify-center gap-2 rounded-md bg-[#0b3dba] px-5 text-sm font-semibold text-white shadow-sm transition hover:bg-blue-600">
+     <i class="fa-solid fa-plus"></i>
+     Add Category
+   </button>
+ </div>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('title', 'Product Types | Avriti Dashboard')
+ @section('content')
+ 
+ @php
+   $openModal = old('_modal');
+ @endphp
+ 
+ <div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
+   <div>
+     <h1 class="text-2xl font-semibold text-[#0b3dba]">Product Types</h1>
+   </div>
+   <button type="button" data-modal-target="createTypeModal" class="inline-flex h-11 items-center justify-center gap-2 rounded-md bg-[#0b3dba] px-5 text-sm font-semibold text-white shadow-sm transition hover:bg-blue-600">
+     <i class="fa-solid fa-plus"></i>
+     Add Type
+   </button>
+ </div>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('title', 'Products | Avriti Dashboard')
+ @section('content')
+ 
+ @php
+   $openModal = old('_modal');
+ @endphp
+ 
+ <div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
+   <div>
+     <h1 class="text-2xl font-semibold text-[#0b3dba]">Products</h1>
+   </div>
+   <button type="button" data-modal-target="createProductModal" class="inline-flex h-11 items-center justify-center gap-2 rounded-md bg-[#0b3dba] px-5 text-sm font-semibold text-white shadow-sm transition hover:bg-blue-600">
+     <i class="fa-solid fa-plus"></i>
+     Add Product
+   </button>
+ </div>
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('title', 'Edit User | Avriti Dashboard')
+ @section('content')
+ 
+ <div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
+   <div>
+     <h1 class="text-2xl font-semibold text-[#0b3dba]">Edit User</h1>
+     <p class="mt-2 text-sm text-gray-500">Update account and profile information.</p>
+   </div>
+   <a href="{{ route('users.index') }}" class="inline-flex h-11 items-center justify-center rounded-full border border-gray-200 bg-white px-5 text-sm font-semibold text-gray-600 shadow-sm transition hover:bg-gray-50">
+     Back
+   </a>
+ </div>
+ 
+ @if (session('success'))
+ <div class="mb-6 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm font-semibold text-emerald-700">
+   {{ session('success') }}
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('title', 'Users | Avriti Dashboard')
+ @section('content')
+ 
+         <div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
+           <div>
+             <h1 class="text-2xl font-semibold text-[#0b3dba]">Users List</h1>
+ 
+           </div>
+ 
+         </div>
+         @if (session('success'))
+           <div class="mb-6 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm font-semibold text-emerald-700">
+             {{ session('success') }}
+           </div>
+         @endif
+         <div class="overflow-hidden rounded-[32px] bg-white shadow-sm">
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('title', 'Units | Avriti Dashboard')
+ @section('content')
+ 
+ @php
+   $openModal = old('_modal');
+ @endphp
+ 
+ <div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
+   <div>
+     <h1 class="text-2xl font-semibold text-[#0b3dba]">Units</h1>
+   </div>
+   <button type="button" data-modal-target="createVariantModal" class="inline-flex h-11 items-center justify-center gap-2 rounded-md bg-[#0b3dba] px-5 text-sm font-semibold text-white shadow-sm transition hover:bg-blue-600">
+     <i class="fa-solid fa-plus"></i>
+     Add Units
+   </button>
+ </div>
Removed / Before Commit

                                                
Added / After Commit
+ <!DOCTYPE html>
+ <html lang="en">
+ <head>
+   <meta charset="UTF-8">
+   <meta name="viewport" content="width=device-width, initial-scale=1.0">
+   <title>@yield('title', 'Avriti Dashboard')</title>
+   @include('partials.css')
+   @stack('styles')
+ </head>
+ <body class="@yield('body_class', 'bg-gray-100 font-sans p-[20px]')">
+   @yield('content')
+   <script>
+     document.querySelectorAll('[data-password-toggle]').forEach((button) => {
+       button.addEventListener('click', () => {
+         const input = button.closest('.relative')?.querySelector('input[type="password"], input[type="text"]');
+ 
+         if (! input) {
+           return;
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ @extends('auth.layouts.auth')
+ 
+ @section('title', 'Users | Avriti Dashboard')
+ @section('body_class', 'bg-gray-100 font-sans p-[20px]')
+ @section('content')
+ <div class="w-full max-w-md bg-white mx-auto rounded-xl overflow-hidden shadow-lg">
+ 
+   <!-- Top Section -->
+   <div class="bg-[#0b3dba] px-8 py-8 relative">
+ 
+     <div class="flex items-center gap-5 justify-center">
+ 
+ 
+ 
+ 
+       <!-- Heading -->
+       <div class="text-center">
+ 
Removed / Before Commit
- @extends('layouts.app')
- 
- @section('title', 'Users | Avriti Dashboard')
- @section('body_class', 'bg-gray-100 font-sans p-[20px]')
- <div class="p-8">
- 
- 
-       <form class="space-y-5">
- 
- <!-- Email -->
- <div>
- 
- <input
- type="email"
- placeholder="Enter email address"
- class="w-full h-12 px-4 border border-gray-300 rounded-md outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent"
- />
- 
Added / After Commit
+ @extends('auth.layouts.auth')
+ 
+ @section('title', 'Users | Avriti Dashboard')
+ @section('body_class', 'bg-gray-100 font-sans p-[20px]')
+ <div class="p-8">
+ 
+ 
+       <form method="POST" action="{{ route('register.store') }}" class="space-y-5">
+         @csrf
+ 
+ <!-- Email -->
+ <div>
+ 
+ <input
+ type="email"
+             name="email"
+             value="{{ old('email') }}"
+ placeholder="Enter email address"
Removed / Before Commit
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>@yield('title', 'Avriti Dashboard')</title>
- @include('partials.css')
- @stack('styles')
- </head>
- <body class="@yield('body_class', 'bg-gray-100 font-sans')">
- </div>
- 
- @include('partials.js')
- @stack('scripts')
- </body>
- </html>
Added / After Commit
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>@yield('title', 'Avriti Dashboard')</title>
+ @include('partials.css')
+   <link rel="stylesheet" href="https://cdn.datatables.net/2.3.2/css/dataTables.dataTables.min.css">
+ @stack('styles')
+ </head>
+ <body class="@yield('body_class', 'bg-gray-100 font-sans')">
+ </div>
+ 
+ @include('partials.js')
+ 
+   <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
+   <script src="https://cdn.datatables.net/2.3.2/js/dataTables.min.js"></script>
+   <script>
+     $(document).ready(function () {
+       $('.js-data-table').each(function () {
+         const actionColumn = $(this).data('action-column');
+         const columnDefs = actionColumn !== undefined ? [{ orderable: false, targets: Number(actionColumn) }] : [];
Removed / Before Commit
- @extends('layouts.app')
- 
- @section('title', 'Users | Avriti Dashboard')
- @section('body_class', 'bg-gray-100 font-sans p-[20px]')
- @section('content')
- <div class="w-full max-w-md bg-white mx-auto rounded-xl overflow-hidden shadow-lg">
- 
-     <!-- Top Section -->
-     <div class="bg-[#0b3dba] px-8 py-8 relative">
- 
-       <div class="flex items-center gap-5 justify-center">
- 
-         
-         
- 
-         <!-- Heading -->
-         <div class="text-center">
- 
Added / After Commit

                                                
Removed / Before Commit
- <!-- Topbar -->
- <header class="bg-[#0b3dba] lg:bg-white border-b border-gray-200 flex items-center justify-between px-6 py-3 flex-shrink-0">
- <!-- Collapse + Search -->
- <div class="flex items-center gap-3">
- <!-- Avatar -->
- <div class="flex items-center gap-2 cursor-pointer">
-       <img src="https://api.dicebear.com/7.x/notionists/svg?seed=John" class="w-9 h-9 rounded-full border-2 border-[#0b3dba] object-cover bg-gray-100"/>
- <div class="leading-tight">
-         <p class="text-sm font-semibold text-white lg:text-gray-800">John Smith</p>
-         <p class="text-xs text-gray-400">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>
- </div>
- </header>
Added / After Commit
+ @php
+   $headerUser = auth()->user();
+   $headerUser?->loadMissing('profile');
+   $headerImage = $headerUser?->profile?->user_img;
+ @endphp
+ 
+ <!-- Topbar -->
+ <header class="bg-[#0b3dba] lg:bg-white border-b border-gray-200 flex items-center justify-between px-6 py-3 flex-shrink-0">
+ <!-- Collapse + Search -->
+ <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>
Removed / Before Commit
- Returns & Refunds
- </span>
- </a>
- </nav>
- </aside>
Added / After Commit
+ Returns & Refunds
+ </span>
+ </a>
+ 
+     <a href="{{ route('product-categories.index') }}" class="flex items-center justify-between px-3 py-2.5 rounded-xl text-white/70 hover:bg-white/10 hover:text-white transition">
+       <span class="flex items-center gap-3">
+         <i class="fa-solid fa-tags"></i>
+         Product Categories
+       </span>
+     </a>
+ 
+     <a href="{{ route('product-types.index') }}" class="flex items-center justify-between px-3 py-2.5 rounded-xl text-white/70 hover:bg-white/10 hover:text-white transition">
+       <span class="flex items-center gap-3">
+         <i class="fa-solid fa-layer-group"></i>
+         Product Types
+       </span>
+     </a>
+ 
Removed / Before Commit
- @extends('layouts.app')
- 
- @section('title', 'Users | Avriti Dashboard')
- @section('content')
- 
-         <div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
-           <div>
-             <h1 class="text-2xl font-semibold text-[#0b3dba]">Users List</h1>
-            
-           </div>
-          
-         </div>
-         <div class="overflow-hidden rounded-[32px] bg-white shadow-sm">
-           <div class="flex flex-col gap-4 border-b border-gray-200 px-6 py-5 sm:flex-row sm:items-center sm:justify-between">
-             <div class="flex flex-col gap-2 sm:flex-row sm:items-center">
-               <div class="rounded-2xl bg-[#eef4ff] px-4 py-3 text-sm font-semibold text-[#1a41b1]">5 Users</div>
-               <p class="text-sm text-gray-500">Latest created accounts shown below.</p>
-             </div>
Added / After Commit

                                                
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use App\Http\Controllers\AuthController;
+ use Illuminate\Support\Facades\Route;
+ 
+ Route::post('/register', [AuthController::class, 'apiRegister'])->name('api.register');
+ Route::post('/login', [AuthController::class, 'apiLogin'])->name('api.login');
+ 
+ Route::middleware('auth:sanctum')->group(function (): void {
+     Route::get('/user', [AuthController::class, 'apiUser'])->name('api.user');
+     Route::post('/logout', [AuthController::class, 'apiLogout'])->name('api.logout');
+ });
Removed / Before Commit
- <?php
- 
- use Illuminate\Support\Facades\Route;
- 
- Route::get('/', function () {
- return view('welcome');
- });
- 
- Route::view('/dashboard', 'dashboard')->name('dashboard');
- Route::view('/users', 'users')->name('users.index');
- Route::view('/profile', 'profile')->name('profile');
- Route::view('/orders', 'orders')->name('orders.index');
- Route::view('/return-refund', 'return-refund')->name('return-refund.index');
- Route::view('/login', 'login')->name('login');
- Route::view('/register', 'register')->name('register');
Added / After Commit
+ <?php
+ 
+ use App\Http\Controllers\AuthController;
+ use App\Http\Controllers\AdminProductCategoryController;
+ use App\Http\Controllers\AdminProductController;
+ use App\Http\Controllers\AdminProductTypeController;
+ use App\Http\Controllers\AdminUserController;
+ use App\Http\Controllers\AdminVariantController;
+ use Illuminate\Support\Facades\Route;
+ 
+ Route::get('/', function () {
+ return view('welcome');
+ });
+ 
+ Route::middleware('guest')->group(function (): void {
+     Route::get('/login', [AuthController::class, 'showLogin'])->name('login');
+     Route::post('/login', [AuthController::class, 'login'])->name('login.store');
+     Route::get('/register', [AuthController::class, 'showRegister'])->name('register');