first commit

This commit is contained in:
ericli1018
2025-06-13 12:29:06 +08:00
commit e781c1e0d7
200 changed files with 31334 additions and 0 deletions

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('12345678'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,32 @@
<?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('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

View File

@ -0,0 +1,28 @@
<?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('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');
}
};

View File

@ -0,0 +1,32 @@
<?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('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
};

View File

@ -0,0 +1,32 @@
<?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('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,33 @@
<?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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@ -0,0 +1,38 @@
<?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::dropIfExists('visitors');
Schema::create('visitors', function (Blueprint $table) {
$table->id();
$table->string("visitable")->nullable();
$table->string("visitable_id")->nullable();
$table->string('auth_id')->nullable();
$table->string('ip')->nullable()->index();
$table->string('referer')->nullable();
$table->string('user_agent')->nullable();
$table->string('path')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('visitors');
}
};

View File

@ -0,0 +1,33 @@
<?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('screening_lotteries', function (Blueprint $table) {
$table->id();
$table->integer('screening_lottery_catalog_id');
$table->string('name');
$table->string('phone');
$table->string('id_number');
$table->string('email');
$table->string('address');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('screening_lotteries');
}
};

View File

@ -0,0 +1,28 @@
<?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('screening_lottery_catalogs', function (Blueprint $table) {
$table->id();
$table->text('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('screening_lottery_catalogs');
}
};

View File

@ -0,0 +1,31 @@
<?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('activities_participants', function (Blueprint $table) {
$table->id();
$table->text('name');
$table->text('phone');
$table->text('id_number');
$table->text('email');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('activities_participants');
}
};

View File

@ -0,0 +1,32 @@
<?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('screening_appointments', function (Blueprint $table) {
$table->id();
$table->integer('screening_appointment_catalog_id');
$table->text('name');
$table->text('phone');
$table->text('id_number');
$table->text('email');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('screening_appointments');
}
};

View File

@ -0,0 +1,28 @@
<?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('screening_appointment_catalogs', function (Blueprint $table) {
$table->id();
$table->text('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('screening_appointment_catalogs');
}
};

View File

@ -0,0 +1,29 @@
<?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::table('screening_lotteries', function($table) {
$table->string('birth')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('screening_lotteries', function($table) {
$table->dropColumn('birth');
});
}
};

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.
*/
public function up(): void
{
Schema::table('screening_appointments', function($table) {
$table->string('address')->nullable();
$table->string('birth')->nullable();
$table->integer('pre_order_time')->nullable();
$table->string('behaviors')->nullable();
$table->string('history')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('screening_appointments', function($table) {
$table->dropColumn('address');
$table->dropColumn('birth');
$table->dropColumn('pre_order_time');
$table->dropColumn('behaviors');
$table->dropColumn('history');
});
}
};

View File

@ -0,0 +1,41 @@
<?php
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// \App\Models\User::factory(10)->create();
\App\Models\User::factory()->create([
'name' => 'master',
'email' => 'master@example.com',
]);
//乳癌、子宮頸癌、大腸癌、口腔癌、BC肝炎
\App\Models\ScreeningAppointmentCatalog::create(['name' => '乳癌']);
\App\Models\ScreeningAppointmentCatalog::create(['name' => '子宮頸癌']);
\App\Models\ScreeningAppointmentCatalog::create(['name' => '大腸癌']);
\App\Models\ScreeningAppointmentCatalog::create(['name' => '口腔癌']);
\App\Models\ScreeningAppointmentCatalog::create(['name' => 'B、C肝炎']);
//子宮頸癌、乳癌、大腸癌、肺癌、口腔癌、B、C肝炎、加碼-乳癌首篩、加碼-大腸癌首篩、加碼-子宮頸癌首篩、加碼-6年未抹、加碼-口腔癌高危險群(曾篩檢陽性)
\App\Models\ScreeningLotteryCatalog::create(['name' => '乳癌']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '子宮頸癌']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '大腸癌']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '口腔癌']);
\App\Models\ScreeningLotteryCatalog::create(['name' => 'B、C肝炎']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '肺癌']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '加碼-乳癌首篩']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '加碼-大腸癌首篩']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '加碼-子宮頸癌首篩']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '加碼-6年未抹']);
\App\Models\ScreeningLotteryCatalog::create(['name' => '加碼-口腔癌高危險群(曾篩檢陽性)']);
}
}