35 lines
860 B
PHP
35 lines
860 B
PHP
|
|
<?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
|
||
|
|
{
|
||
|
|
// Pastikan ini 'foods' (jamak), bukan 'food'
|
||
|
|
Schema::create('foods', function (Blueprint $table) {
|
||
|
|
$table->id();
|
||
|
|
$table->string('nama_makanan');
|
||
|
|
$table->string('slug')->unique()->nullable();
|
||
|
|
$table->integer('qty');
|
||
|
|
$table->string('unit');
|
||
|
|
$table->foreignId('category_id')->nullable()->constrained('categories')->onDelete('set null');
|
||
|
|
$table->string('kategori')->default('Umum');
|
||
|
|
$table->timestamps();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Reverse the migrations.
|
||
|
|
*/
|
||
|
|
public function down(): void
|
||
|
|
{
|
||
|
|
Schema::dropIfExists('foods');
|
||
|
|
}
|
||
|
|
};
|