feat: meal post visibility
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\MealPostVisibility;
|
||||
use App\Models\MealPosts;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
@@ -22,6 +23,7 @@ class MealPostsFactory extends Factory
|
||||
'fats' => $this->faker->randomFloat(),
|
||||
'title' => $this->faker->word(),
|
||||
'eaten_at' => Carbon::now(),
|
||||
'visibility' => MealPostVisibility::Private,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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::table('meal_posts', function (Blueprint $table): void {
|
||||
$table
|
||||
->string('visibility', 20)
|
||||
->default('private')
|
||||
->index();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('meal_posts', function (Blueprint $table): void {
|
||||
$table->dropIndex(['visibility']);
|
||||
$table->dropColumn('visibility');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user