Compare commits
2 Commits
a35b50bec6
...
e7481eac95
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7481eac95 | ||
|
|
0c6bab4a04 |
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Resources\DynamicResource;
|
||||||
use App\Models\Dynamic;
|
use App\Models\Dynamic;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
@ -44,7 +45,7 @@ class ParticipantController extends Controller
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
return Inertia::render('Dynamics/Participants/Show', [
|
return Inertia::render('Dynamics/Participants/Show', [
|
||||||
'dynamic' => $dynamic,
|
'dynamic' => new DynamicResource($dynamic),
|
||||||
'participant' => [
|
'participant' => [
|
||||||
'id' => $user->id,
|
'id' => $user->id,
|
||||||
'name' => $user->name,
|
'name' => $user->name,
|
||||||
|
|||||||
@ -13,10 +13,11 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('predefined_mutations', function (Blueprint $table) {
|
Schema::create('predefined_mutations', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('ledger_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('dynamic_id')->constrained()->cascadeOnDelete();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->text('description')->nullable();
|
$table->text('description')->nullable();
|
||||||
$table->integer('amount');
|
$table->integer('amount');
|
||||||
|
$table->string('type')->default('reward');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
<?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('predefined_mutations', function (Blueprint $table) {
|
||||||
|
// Drop old foreign key constraint first
|
||||||
|
$table->dropForeign(['dynamic_id']);
|
||||||
|
|
||||||
|
// Drop old columns
|
||||||
|
$table->dropColumn(['dynamic_id', 'type']);
|
||||||
|
|
||||||
|
// Add new ledger relationship (nullable to support pre-existing entries gracefully)
|
||||||
|
$table->foreignId('ledger_id')
|
||||||
|
->after('id')
|
||||||
|
->nullable()
|
||||||
|
->constrained()
|
||||||
|
->cascadeOnDelete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('predefined_mutations', function (Blueprint $table) {
|
||||||
|
$table->dropConstrainedForeignId('ledger_id');
|
||||||
|
$table->foreignId('dynamic_id')->after('id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->string('type')->default('reward');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -196,7 +196,7 @@ function getAmountClass(amount: number): string {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Chat :chat="mutation.chat" :dynamic-id="dynamicId" :participants="participants" />
|
<Chat v-if="mutation.chat" :chat="mutation.chat" :dynamic-id="dynamicId" :participants="participants" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div v-if="mutations.length === 0" class="c-mutation-list__empty">
|
<div v-if="mutations.length === 0" class="c-mutation-list__empty">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user