diff --git a/app/Classes/ValueObjects/Constants/BusinessType.php b/app/Classes/ValueObjects/Constants/BusinessType.php new file mode 100644 index 00000000..4f9029c9 --- /dev/null +++ b/app/Classes/ValueObjects/Constants/BusinessType.php @@ -0,0 +1,9 @@ +hasOne(Country::class, 'country_id', 'id'); + } + + /** + * @return \Illuminate\Database\Eloquent\Relations\HasOne + **/ + public function company(): HasOne + { + return $this->hasOne(Company::class, 'company_id', 'id'); + } +} diff --git a/database/migrations/2020_10_22_071102_create_companies_table.php b/database/migrations/2020_10_22_071102_create_companies_table.php index aefff45d..191be926 100644 --- a/database/migrations/2020_10_22_071102_create_companies_table.php +++ b/database/migrations/2020_10_22_071102_create_companies_table.php @@ -15,9 +15,10 @@ class CreateCompaniesTable extends Migration { Schema::create('companies', function (Blueprint $table) { $table->id(); - $table->string('name')->nullable(); - $table->string('reference')->nullable(); - $table->integer('type')->nullable(); + $table->string('name'); + $table->string('reference'); + $table->integer('type'); + $table->integer('business_type')->default(1); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2020_11_24_062534_create_company_banks_table.php b/database/migrations/2020_11_24_062534_create_company_banks_table.php new file mode 100644 index 00000000..34150130 --- /dev/null +++ b/database/migrations/2020_11_24_062534_create_company_banks_table.php @@ -0,0 +1,41 @@ +id(); + $table->bigInteger('country_id')->unsigned()->nullable(); + $table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade'); + $table->bigInteger('company_id')->unsigned()->nullable(); + $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); + $table->string('bank_name'); + $table->string('holder_name'); + $table->string('account_no'); + $table->integer('type'); + $table->integer('default'); + $table->integer('status'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('company_banks'); + } +} diff --git a/database/seeds/CompaniesTableSeeder.php b/database/seeds/CompaniesTableSeeder.php new file mode 100644 index 00000000..54a0a74b --- /dev/null +++ b/database/seeds/CompaniesTableSeeder.php @@ -0,0 +1,27 @@ +insert([ + [ + 'id' => 1, + 'name' => 'CIEF SDN BHD', + 'reference' => 'CIEF', + 'type' => 2, + 'business_type' => 1, + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s') + ] + ]); + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index cdfc22d4..72afc412 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -21,6 +21,8 @@ class DatabaseSeeder extends Seeder $this->call(SegmentsTableSeeder::class); $this->call(SegmentConstantsTableSeeder::class); + + $this->call(CompaniesTableSeeder::class); // Admin $this->call(AdminUserTableSeeder::class);