client api
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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('administrative_regions', function (Blueprint $table) {
|
||||
$table->integer('id')->primary();
|
||||
$table->string('name');
|
||||
$table->string('name_en');
|
||||
$table->string('code_name')->nullable();
|
||||
$table->string('code_name_en')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('administrative_regions');
|
||||
}
|
||||
};
|
||||
@@ -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('administrative_units', function (Blueprint $table) {
|
||||
$table->integer('id')->primary();
|
||||
$table->string('full_name')->nullable();
|
||||
$table->string('full_name_en')->nullable();
|
||||
$table->string('short_name')->nullable();
|
||||
$table->string('short_name_en')->nullable();
|
||||
$table->string('code_name')->nullable();
|
||||
$table->string('code_name_en')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('administrative_units');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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('provinces', function (Blueprint $table) {
|
||||
$table->string('code', 20)->primary();
|
||||
$table->string('name');
|
||||
$table->string('name_en')->nullable();
|
||||
$table->string('full_name');
|
||||
$table->string('full_name_en')->nullable();
|
||||
$table->string('code_name')->nullable();
|
||||
$table->integer('administrative_unit_id')->nullable();
|
||||
|
||||
$table->foreign('administrative_unit_id')
|
||||
->references('id')
|
||||
->on('administrative_units')
|
||||
->onDelete('set null');
|
||||
|
||||
$table->index('administrative_unit_id', 'idx_provinces_unit');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('provinces');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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('wards', function (Blueprint $table) {
|
||||
$table->string('code', 20)->primary();
|
||||
$table->string('name');
|
||||
$table->string('name_en')->nullable();
|
||||
$table->string('full_name')->nullable();
|
||||
$table->string('full_name_en')->nullable();
|
||||
$table->string('code_name')->nullable();
|
||||
$table->string('province_code', 20)->nullable();
|
||||
$table->integer('administrative_unit_id')->nullable();
|
||||
|
||||
$table->foreign('administrative_unit_id')
|
||||
->references('id')
|
||||
->on('administrative_units')
|
||||
->onDelete('set null');
|
||||
|
||||
$table->foreign('province_code')
|
||||
->references('code')
|
||||
->on('provinces')
|
||||
->onDelete('set null');
|
||||
|
||||
$table->index('province_code', 'idx_wards_province');
|
||||
$table->index('administrative_unit_id', 'idx_wards_unit');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('wards');
|
||||
}
|
||||
};
|
||||
@@ -13,10 +13,10 @@ return new class extends Migration {
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::create('customer', function (Blueprint $table) {
|
||||
Schema::create('customers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('firstname', 100)->nullable();
|
||||
$table->string('lastname', 100)->nullable();
|
||||
$table->uuid('uuid')->unique();
|
||||
$table->string('fullname', 100)->nullable();
|
||||
$table->string('avatar', 100)->nullable();
|
||||
$table->integer('gender')->default(0);
|
||||
$table->string('address', 100)->nullable();
|
||||
@@ -34,12 +34,27 @@ return new class extends Migration {
|
||||
$table->string('password')->nullable();
|
||||
$table->integer('credit')->default(0);
|
||||
$table->integer('total')->default(0);
|
||||
$table->string('cccd')->nullable();
|
||||
$table->string('front_cccd')->nullable();
|
||||
$table->string('back_cccd')->nullable();
|
||||
$table->string('identity_number')->nullable();
|
||||
$table->string('front_identity_number')->nullable();
|
||||
$table->string('back_identity_number')->nullable();
|
||||
$table->string('province_code', 20)->nullable();
|
||||
$table->string('ward_code', 20)->nullable();
|
||||
$table->string('remember_token', 100)->nullable();
|
||||
$table->tinyInteger('status')->default(1);
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('province_code')
|
||||
->references('code')
|
||||
->on('provinces')
|
||||
->onDelete('set null');
|
||||
|
||||
$table->foreign('ward_code')
|
||||
->references('code')
|
||||
->on('wards')
|
||||
->onDelete('set null');
|
||||
|
||||
$table->index('province_code', 'idx_users_province');
|
||||
$table->index('ward_code', 'idx_users_ward');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ return new class extends Migration
|
||||
|
||||
// 3. Add foreign key constraints
|
||||
Schema::table('order', function (Blueprint $table) {
|
||||
$table->foreign('customer_id')->references('id')->on('customer')->onDelete('set null');
|
||||
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('set null');
|
||||
$table->foreign('user_id')->references('id')->on('user')->onDelete('set null');
|
||||
$table->foreign('discount_id')->references('id')->on('discount')->onDelete('set null');
|
||||
$table->foreign('invoice_id')->references('id')->on('invoice')->onDelete('set null');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,6 @@ class DatabaseSeeder extends Seeder
|
||||
User::factory(1)->create();
|
||||
$this->call(TypeSeeder::class);
|
||||
$this->call(DomainTypeSeeder::class);
|
||||
Customer::factory(10)->create();
|
||||
$this->call(GroupSeeder::class);
|
||||
$this->call(Payment::class);
|
||||
$this->call(AddonSeeder::class);
|
||||
|
||||
Reference in New Issue
Block a user