From df9b68ae4684908ee4c0a5128cfb9ec0fd71d7fb Mon Sep 17 00:00:00 2001 From: majid Date: Thu, 5 Sep 2024 14:43:05 +0700 Subject: [PATCH] update migration and models (penilaian, jenis_penilaian, teams, teams_users --- app/Models/JenisPenilaian.php | 22 ++++++++++ app/Models/Penilaian.php | 38 +++++++++++++++++ app/Models/Regions.php | 26 ++++++++++++ app/Models/Teams.php | 28 +++++++++++++ app/Models/TeamsUsers.php | 32 ++++++++++++++ ...2024_09_05_030302_create_regions_table.php | 36 ++++++++++++++++ ...05_030338_create_jenis_penilaian_table.php | 37 ++++++++++++++++ .../2024_09_05_030405_create_teams_table.php | 41 ++++++++++++++++++ ..._09_05_030417_create_teams_users_table.php | 41 ++++++++++++++++++ ...24_09_05_070712_create_penilaian_table.php | 42 +++++++++++++++++++ module.json | 11 +++++ 11 files changed, 354 insertions(+) create mode 100644 app/Models/JenisPenilaian.php create mode 100644 app/Models/Penilaian.php create mode 100644 app/Models/Regions.php create mode 100644 app/Models/Teams.php create mode 100644 app/Models/TeamsUsers.php create mode 100644 database/migrations/2024_09_05_030302_create_regions_table.php create mode 100644 database/migrations/2024_09_05_030338_create_jenis_penilaian_table.php create mode 100644 database/migrations/2024_09_05_030405_create_teams_table.php create mode 100644 database/migrations/2024_09_05_030417_create_teams_users_table.php create mode 100644 database/migrations/2024_09_05_070712_create_penilaian_table.php diff --git a/app/Models/JenisPenilaian.php b/app/Models/JenisPenilaian.php new file mode 100644 index 0000000..2ac6459 --- /dev/null +++ b/app/Models/JenisPenilaian.php @@ -0,0 +1,22 @@ +hasMany(JenisPenilaian::class); + } + + public function teams(){ + return $this->hasMany(Teams::class); + } + + public function users(){ + return $this->hasMany(User::class); + } + + +} diff --git a/app/Models/Regions.php b/app/Models/Regions.php new file mode 100644 index 0000000..bfa8e0a --- /dev/null +++ b/app/Models/Regions.php @@ -0,0 +1,26 @@ +hasMany(Teams::class, 'region_id', 'id'); + } +} diff --git a/app/Models/Teams.php b/app/Models/Teams.php new file mode 100644 index 0000000..bc9f7fe --- /dev/null +++ b/app/Models/Teams.php @@ -0,0 +1,28 @@ +belongsTo(Regions::class, 'region_id', 'id'); + } + + public function teamsUsers(){ + return $this->hasMany(TeamsUsers::class, 'team_id', 'id'); + } +} diff --git a/app/Models/TeamsUsers.php b/app/Models/TeamsUsers.php new file mode 100644 index 0000000..6516730 --- /dev/null +++ b/app/Models/TeamsUsers.php @@ -0,0 +1,32 @@ +belongsTo(Teams::class, 'team_id'); + } + + public function user() + { + return $this->belongsTo(User::class, 'user_id'); + } +} diff --git a/database/migrations/2024_09_05_030302_create_regions_table.php b/database/migrations/2024_09_05_030302_create_regions_table.php new file mode 100644 index 0000000..3f942ff --- /dev/null +++ b/database/migrations/2024_09_05_030302_create_regions_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->char('status')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->softDeletes(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('regions'); + } +}; diff --git a/database/migrations/2024_09_05_030338_create_jenis_penilaian_table.php b/database/migrations/2024_09_05_030338_create_jenis_penilaian_table.php new file mode 100644 index 0000000..bf31ab4 --- /dev/null +++ b/database/migrations/2024_09_05_030338_create_jenis_penilaian_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->char('status')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->softDeletes(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('jenis_penilaian'); + } +}; diff --git a/database/migrations/2024_09_05_030405_create_teams_table.php b/database/migrations/2024_09_05_030405_create_teams_table.php new file mode 100644 index 0000000..88ae841 --- /dev/null +++ b/database/migrations/2024_09_05_030405_create_teams_table.php @@ -0,0 +1,41 @@ +id(); + $table->foreignIdFor(Regions::class, 'region_id'); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->char('status')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->softDeletes(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('teams'); + } +}; diff --git a/database/migrations/2024_09_05_030417_create_teams_users_table.php b/database/migrations/2024_09_05_030417_create_teams_users_table.php new file mode 100644 index 0000000..9b4422e --- /dev/null +++ b/database/migrations/2024_09_05_030417_create_teams_users_table.php @@ -0,0 +1,41 @@ +id(); + $table->foreignIdFor(Teams::class); + $table->foreignIdFor(Users::class); + + + $table->char('status')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->softDeletes(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('teams_users'); + } +}; diff --git a/database/migrations/2024_09_05_070712_create_penilaian_table.php b/database/migrations/2024_09_05_070712_create_penilaian_table.php new file mode 100644 index 0000000..14d7766 --- /dev/null +++ b/database/migrations/2024_09_05_070712_create_penilaian_table.php @@ -0,0 +1,42 @@ +id(); + $table->foreignIdFor(Penilaian::class); + $table->foreignIdFor(Teams::class); + $table->foreignIdFor(Users::class); + $table->datetime('tanggal_kunjungan'); + $table->text('keterangan'); + $table->char('status'); + $table->timestamps(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->softDeletes(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('penilaian'); + } +}; diff --git a/module.json b/module.json index 40ce5bd..de8b0cc 100644 --- a/module.json +++ b/module.json @@ -65,6 +65,17 @@ "roles": [ "Administrator" ] + }, + { + "title": "Region", + "path": "", + "icon": "ki-filled ki-some-files text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": [ + "Administrator" + ] } ], "master": [