39 lines
910 B
PHP
39 lines
910 B
PHP
<?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\Framework;
|
|
use App\Models\Program\Aktivitas;
|
|
|
|
class Transformasi extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'program_transformasi';
|
|
|
|
protected $fillable = [
|
|
"kode",
|
|
"nama",
|
|
"framework_id",
|
|
];
|
|
|
|
public function framework(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Framework::class, 'framework_id', 'id');
|
|
}
|
|
|
|
public function tujuan(): HasMany
|
|
{
|
|
return $this->hasMany(Aktivitas::class, 'transformasi_id', 'id')
|
|
->whereNull('parent_id')
|
|
->where('jenis_aktivitas', 'tujuan')
|
|
->orderBy('kode', 'asc')
|
|
->orderBy('id', 'asc');
|
|
}
|
|
}
|