38 lines
954 B
PHP
38 lines
954 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
|
||
|
|
{
|
||
|
|
Schema::create('medicines', function (Blueprint $table) {
|
||
|
|
$table->id();
|
||
|
|
$table->string('nama_obat');
|
||
|
|
$table->string('slug')->unique()->nullable();
|
||
|
|
$table->string('foto_produk')->nullable();
|
||
|
|
|
||
|
|
$table->string('kategori')->default('Umum');
|
||
|
|
|
||
|
|
$table->foreignId('category_id')->nullable()->constrained('categories')->onDelete('set null');
|
||
|
|
|
||
|
|
$table->integer('qty')->default(0);
|
||
|
|
$table->string('unit')->default('Pcs');
|
||
|
|
$table->date('expired_date')->nullable();
|
||
|
|
$table->timestamps();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Reverse the migrations.
|
||
|
|
*/
|
||
|
|
public function down(): void
|
||
|
|
{
|
||
|
|
Schema::dropIfExists('medicines');
|
||
|
|
}
|
||
|
|
};
|