api person create & update & add family

This commit is contained in:
Muhammad Fajar
2022-11-01 14:41:59 +07:00
parent a34fb34180
commit ba0023544f
10 changed files with 345 additions and 132 deletions

View File

@@ -0,0 +1,37 @@
<?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('family_relations', function (Blueprint $table) {
$table->id();
$table->string('relation_with_owner');
$table->timestamps();
$table->softDeletes();
$table->foreignId('created_by')->nullable();
$table->foreignId('updated_by')->nullable();
$table->foreignId('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('family_relations');
}
};

View File

@@ -0,0 +1,34 @@
<?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::table('family_relations', function (Blueprint $table) {
$table->foreignId('owner_id')->nullable()->after('id');
$table->foreignId('person_id')->nullable()->after('relation_with_owner');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('family_relations', function (Blueprint $table) {
$table->dropColumn('owner_id');
$table->dropColumn('person_id');
});
}
};