Merge branch 'main' of https://git.probindo.com/Probindo/database-pertani-web
This commit is contained in:
@@ -23,6 +23,9 @@ class Aktivitas extends Model
|
||||
"indikator",
|
||||
"deskripsi",
|
||||
"transformasi_id",
|
||||
"parent_id",
|
||||
"created_by",
|
||||
"updated_by"
|
||||
];
|
||||
|
||||
public function transformasi(): BelongsTo
|
||||
@@ -32,6 +35,20 @@ class Aktivitas extends Model
|
||||
|
||||
public function target(): HasMany
|
||||
{
|
||||
return $this->hasMany(Target::class, 'aktivitas_id', 'id');
|
||||
return $this->hasMany(Target::class, 'aktivitas_id', 'id')
|
||||
->orderBy('id', 'asc');
|
||||
}
|
||||
|
||||
public function parent(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Aktivitas::class, 'parent_id', 'id');
|
||||
}
|
||||
|
||||
public function aktivitas(): HasMany
|
||||
{
|
||||
return $this->hasMany(Aktivitas::class, 'parent_id', 'id')
|
||||
->where('jenis_aktivitas', 'aktivitas')
|
||||
->orderBy('kode', 'asc')
|
||||
->orderBy('id', 'asc');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ class Framework extends Model
|
||||
"nama",
|
||||
"tahun",
|
||||
"program_id",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
];
|
||||
|
||||
public function program(): BelongsTo
|
||||
@@ -29,6 +31,8 @@ class Framework extends Model
|
||||
|
||||
public function transformasi(): HasMany
|
||||
{
|
||||
return $this->hasMany(Transformasi::class, 'framework_id', 'id');
|
||||
return $this->hasMany(Transformasi::class, 'framework_id', 'id')
|
||||
->orderBy('kode', 'asc')
|
||||
->orderBy('id', 'asc');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Program;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
use App\Models\Program\Target;
|
||||
|
||||
class Realisasi extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'program_realisasi';
|
||||
|
||||
protected $fillable = [
|
||||
"target_id",
|
||||
"realisasi_integer",
|
||||
"realisasi_float",
|
||||
"realisasi_boolean",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"deleted_by",
|
||||
];
|
||||
|
||||
public function target(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Target::class, 'target_id', 'id');
|
||||
}
|
||||
|
||||
public function verifikasi(): HasMany
|
||||
{
|
||||
return $this->hasMany(Verifikasi::class, 'realisasi_id', 'id')->oldest();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace App\Models\Program;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
use App\Models\Program\Aktivitas;
|
||||
|
||||
@@ -27,10 +29,25 @@ class Target extends Model
|
||||
"realisasi_float",
|
||||
"realisasi_boolean",
|
||||
"aktivitas_id",
|
||||
"tipe_realisasi",
|
||||
"value_query",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"deleted_by",
|
||||
];
|
||||
|
||||
public function aktivitas(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Aktivitas::class, 'aktivitas_id', 'id');
|
||||
}
|
||||
|
||||
public function realisasi(): HasMany
|
||||
{
|
||||
return $this->hasMany(Realisasi::class, 'target_id', 'id')->latest();
|
||||
}
|
||||
|
||||
public function latestRealisasi(): HasOne
|
||||
{
|
||||
return $this->hasOne(Realisasi::class, 'target_id', 'id')->latest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,12 @@ class Transformasi extends Model
|
||||
return $this->belongsTo(Framework::class, 'framework_id', 'id');
|
||||
}
|
||||
|
||||
public function aktivitas(): HasMany
|
||||
public function tujuan(): HasMany
|
||||
{
|
||||
return $this->hasMany(Aktivitas::class, 'transformasi_id', 'id');
|
||||
return $this->hasMany(Aktivitas::class, 'transformasi_id', 'id')
|
||||
->whereNull('parent_id')
|
||||
->where('jenis_aktivitas', 'tujuan')
|
||||
->orderBy('kode', 'asc')
|
||||
->orderBy('id', 'asc');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Program;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
use App\Models\Program\Realisasi;
|
||||
|
||||
class Verifikasi extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'program_verifikasi';
|
||||
|
||||
protected $fillable = [
|
||||
"realisasi_id",
|
||||
"dokumen",
|
||||
"link_dokumen",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"deleted_by",
|
||||
];
|
||||
|
||||
public function realisasi(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Realisasi::class, 'realisasi_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user