Add favorite toggle to yoga poses
Exercises and workouts both have a favorite toggle; yoga poses had an otherwise identical browse/filter UX but no way to favorite them - an inconsistency rather than a deliberate omission. Mirrors the existing exercise/workout favorite pattern exactly: a pivot table, a belongsToMany on User, and a toggle button on the pose detail page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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('yoga_pose_favorites', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('yoga_pose_id')->constrained('yoga_poses')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
$table->unique(['user_id', 'yoga_pose_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('yoga_pose_favorites');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user