0% found this document useful (0 votes)
6 views1 page

Laravel Migration for Transactions Table

This migration file creates a transaction table with fields for an ID, user ID, transaction number, total price, status, and timestamps and defines up and down methods to create and drop the table.

Uploaded by

riza
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Laravel Migration for Transactions Table

This migration file creates a transaction table with fields for an ID, user ID, transaction number, total price, status, and timestamps and defines up and down methods to create and drop the table.

Uploaded by

riza
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<?

php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration


{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transaction', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->unsigned();
$table->string('no_trans');
$table->string('total_harga');
$table->string('status');
$table->foreign('user_id')->references('id')->on('users')-
>onDelete('cascade');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transaction');
}
};

You might also like