update migration and models (penilaian, jenis_penilaian, teams, teams_users
This commit is contained in:
22
app/Models/JenisPenilaian.php
Normal file
22
app/Models/JenisPenilaian.php
Normal 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
38
app/Models/Penilaian.php
Normal 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
26
app/Models/Regions.php
Normal 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
28
app/Models/Teams.php
Normal 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
32
app/Models/TeamsUsers.php
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user