- Updated interaction models and relations for handling of user-deal interactions. - Added frontend interactivity with `interaction.js` for toggling like buttons.
35 lines
830 B
PHP
35 lines
830 B
PHP
<?php
|
|
|
|
use App\Enums\InteractionType;
|
|
use App\Models\Deal;
|
|
use App\Models\User;
|
|
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('interactions', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignIdFor(User::class);
|
|
$table->foreignIdFor(Deal::class);
|
|
$table->enum('type', InteractionType::values());
|
|
$table->unsignedBigInteger('count')->default(1);
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('interactions');
|
|
}
|
|
};
|