update migration and models (penilaian, jenis_penilaian, teams, teams_users

This commit is contained in:
majid 2024-09-05 14:43:05 +07:00
parent 22e2ff51f0
commit df9b68ae46
11 changed files with 354 additions and 0 deletions

View File

@ -0,0 +1,22 @@
<?php
namespace Modules\Lpj\Models;
use Illuminate\Database\Eloquent\Model;
use Modules\Lpj\Database\Factories\JenisPenilaianFactory;
class JenisPenilaian extends Model
{
/**
* The attributes that are mass assignable.
*/
protected $table = 'jenis_penilaian';
protected $fillable = [
'code', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by',
'created_at', 'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
];
}

38
app/Models/Penilaian.php Normal file
View File

@ -0,0 +1,38 @@
<?php
namespace Modules\Lpj\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Lpj\Database\Factories\PenilaianFactory;
use Modules\Lpj\Models\JenisPenilaian;
use Modules\Lpj\Models\Teams;
use Modules\Usermanagement\Models\User;
class Penilaian extends Model
{
/**
* The attributes that are mass assignable.
*/
protected $table = 'penilaian';
protected $fillable = [
'jenis_penilaian_id', 'team_id', 'user_id', 'tanggal_kunjungan', 'keterangan',
'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at',
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
];
public function jenis_penilaian(){
return $this->hasMany(JenisPenilaian::class);
}
public function teams(){
return $this->hasMany(Teams::class);
}
public function users(){
return $this->hasMany(User::class);
}
}

26
app/Models/Regions.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace Modules\Lpj\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Lpj\Database\Factories\RegionsFactory;
class Regions extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $table = 'regions';
protected $fillable = [
'code', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by',
'created_at', 'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
];
public function teams(){
return $this->hasMany(Teams::class, 'region_id', 'id');
}
}

28
app/Models/Teams.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace Modules\Lpj\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Lpj\Database\Factories\TeamsFactory;
class Teams extends Model
{
/**
* The attributes that are mass assignable.
*/
protected $table = 'teams';
protected $fillable = [
'region_id', 'code', 'name', 'status', 'authorized_status', 'authorized_at',
'authorized_by', 'created_at', 'created_by', 'updated_at', 'updated_by',
'deleted_at', 'deleted_by'
];
public function regions(){
return $this->belongsTo(Regions::class, 'region_id', 'id');
}
public function teamsUsers(){
return $this->hasMany(TeamsUsers::class, 'team_id', 'id');
}
}

32
app/Models/TeamsUsers.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace Modules\Lpj\Models;
use Illuminate\Database\Eloquent\Model;
use Modules\Lpj\Database\Factories\TeamsUsersFactory;
use Modules\User\Models\User;
use Modules\Lpj\Models\Teams;
class TeamsUsers extends Model
{
/**
* The attributes that are mass assignable.
*/
protected $table = 'teams_users';
protected $fillable = [
'team_id', 'user_id', 'status', 'authorized_status', 'authorized_at',
'authorized_by', 'created_at', 'created_by', 'updated_at', 'updated_by',
'deleted_at', 'deleted_by'
];
public function team()
{
return $this->belongsTo(Teams::class, 'team_id');
}
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
}

View File

@ -0,0 +1,36 @@
<?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('regions', function (Blueprint $table) {
$table->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');
}
};

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::create('jenis_penilaian', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Mudels\Lpj\Models\Regions;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('teams', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Modules\Lpj\Models\Teams;
use Modules\Lpj\Models\Users;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('teams_users', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Modules\Lpj\Models\Penilaian;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('penilaian', function (Blueprint $table) {
$table->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');
}
};

View File

@ -65,6 +65,17 @@
"roles": [
"Administrator"
]
},
{
"title": "Region",
"path": "",
"icon": "ki-filled ki-some-files text-lg",
"classes": "",
"attributes": [],
"permission": "",
"roles": [
"Administrator"
]
}
],
"master": [