[WIP]
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?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('claims', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code')->index();
|
||||
$table->foreignId('member_id')->index();
|
||||
$table->foreignId('diagnosis_id')->index();
|
||||
$table->string('total_claim');
|
||||
$table->string('currency');
|
||||
$table->foreignId('plan_id')->index();
|
||||
$table->foreignId('benefit_id')->index();
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->unsignedBigInteger('created_by')->nullable()->index();
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->index();
|
||||
$table->unsignedBigInteger('deleted_by')->nullable()->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('claims');
|
||||
}
|
||||
};
|
||||
36
database/seeders/DummyClaimSeeder.php
Normal file
36
database/seeders/DummyClaimSeeder.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Icd;
|
||||
use App\Models\Member;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Str;
|
||||
|
||||
class DummyClaimSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$members = Member::limit(10)->get();
|
||||
|
||||
foreach ($members as $member) {
|
||||
for ($x = 0; $x < 10; $x++) {
|
||||
$member->claims()->create([
|
||||
'code' => Str::random('16'),
|
||||
'member_id' => $member->id,
|
||||
'diagnosis_id' => Icd::inRandomOrder()->first()->id,
|
||||
'total_claim' => 5000000,
|
||||
'currency' => 'IDR',
|
||||
'plan_id' => $member->currentPlan->id,
|
||||
'benefit_id' => $member->currentPlan->benefits()->inRandomOrder()->first()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user