Skip to content

Commit

Permalink
feat: add food name column in food record
Browse files Browse the repository at this point in the history
  • Loading branch information
amrron committed Oct 21, 2024
1 parent 9b8aed7 commit 9fc93ee
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Http/Resources/FoodRecordResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function toArray(Request $request): array
{
return [
'id' => $this->id,
'nama' => $this->name,
'jumlah' => $this->jumlah,
'waktu' => $this->waktu,
'karbohidrat' => $this->karbohidrat,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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('food_records', function (Blueprint $table) {
$table->string('name')->after('user_id');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('food_records', function (Blueprint $table) {
//
});
}
};

0 comments on commit 9fc93ee

Please sign in to comment.