Initial Commit

This commit is contained in:
dann4624
2022-09-28 09:38:08 +02:00
parent cac476f80f
commit 2d04a269e6
355 changed files with 52166 additions and 25 deletions
@@ -0,0 +1,49 @@
<?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('loans', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('loan_type_id');
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('room_id')->nullable();
$table->morphs('loanable');
$table->date('date_start');
$table->date('date_end')->nullable();
$table->timestamp('date_deadline')->nullable();
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('room_id')->references('id')->on('rooms')->onDelete('cascade');
$table->foreign('loan_type_id')->references('id')->on('loan_types')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('loans');
}
};