Add product view tracking and related functionality

- Implemented product view tracking in ProductController to log user views.
- Added a relationship for viewed products in the User model.
- Introduced a method in ProductRepository to filter products viewed by a user.
- Updated API routes to include endpoint for retrieving viewed products.
- Commented out SMS notification logic in SendOrderCreatedNotification.
- Removed CreateOrderServiceTest as it is no longer needed.
This commit is contained in:
Mekan1206
2026-02-08 02:02:30 +05:00
parent dee6b0df56
commit 968c9ed42a
11 changed files with 319 additions and 86 deletions

View File

@@ -0,0 +1,29 @@
<?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_views', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('product_id')->constrained()->cascadeOnDelete();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_views');
}
};