monev sampai target
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Program;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
use App\Models\Program\Framework;
|
||||
use App\Models\Program\Transformasi;
|
||||
use App\Models\Program\Aktivitas;
|
||||
|
||||
class AktivitasController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request, string $frameworkId, string $transformasiId): JsonResponse
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$transformasi = Transformasi::where('framework_id', $frameworkId)->find($transformasiId);
|
||||
if (!$transformasi) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data transformasi tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'kode' => ['required','string','max:255'],
|
||||
'nama' => ['required','string','max:255'],
|
||||
'jenis_aktivitas' => ['required','string','max:255', Rule::in(['tujuan', 'aktivitas']),],
|
||||
'indikator' => ['required','string'],
|
||||
'deskripsi' => ['required','string'],
|
||||
]);
|
||||
|
||||
Aktivitas::create([...$validated,
|
||||
'transformasi_id' => $transformasiId,
|
||||
'created_by' => auth()->id(),
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Aktivitas berhasil ditambahkan.'
|
||||
], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $frameworkId, string $transformasiId, string $id)
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$aktivitas = Aktivitas::whereHas('transformasi', function ($query) use ($frameworkId) {
|
||||
$query->where('framework_id', $frameworkId);
|
||||
})->where('transformasi_id', $transformasiId)->find($id);
|
||||
|
||||
if (!$aktivitas) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data aktivitas tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
return response()->json(['data' => $aktivitas, 'status' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $frameworkId, string $transformasiId, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $frameworkId, string $transformasiId, string $id)
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$aktivitas = Aktivitas::whereHas('transformasi', function ($query) use ($frameworkId) {
|
||||
$query->where('framework_id', $frameworkId);
|
||||
})->where('transformasi_id', $transformasiId)->find($id);
|
||||
|
||||
if (!$aktivitas) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data aktivitas tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'kode' => ['required','string','max:255'],
|
||||
'nama' => ['required','string','max:255'],
|
||||
'jenis_aktivitas' => ['required','string','max:255', Rule::in(['tujuan', 'aktivitas']),],
|
||||
'indikator' => ['required','string'],
|
||||
'deskripsi' => ['required','string'],
|
||||
]);
|
||||
|
||||
$aktivitas->update([...$validated,
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Aktivitas berhasil diperbarui.'
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $frameworkId, string $transformasiId, string $id)
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$aktivitas = Aktivitas::whereHas('transformasi', function ($query) use ($frameworkId) {
|
||||
$query->where('framework_id', $frameworkId);
|
||||
})->where('transformasi_id', $transformasiId)->find($id);
|
||||
|
||||
if (!$aktivitas) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data aktivitas tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$aktivitas->delete();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Aktivitas berhasil dihapus.'
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Program;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
use App\Models\Program\Framework;
|
||||
use App\Models\Core\Program;
|
||||
|
||||
class FrameworkController extends Controller
|
||||
{
|
||||
public function index(Request $request): View
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$title = 'Kerangka Kerja';
|
||||
|
||||
$perPage = $request->query('per_page', 10);
|
||||
$search = $request->query('search', '');
|
||||
|
||||
$framework = Framework::where('nama', 'like', "%$search%")
|
||||
->paginate($perPage);
|
||||
|
||||
return view('program.framework.index', compact('title', 'framework'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$program = Program::all();
|
||||
|
||||
return view('program.framework.add', compact('program'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
if (app()->has('SystemProgram')) {
|
||||
$program = app('SystemProgram');
|
||||
} else {
|
||||
if ($request->has('program_id') && $request->input('program_id')) {
|
||||
$programId = $request->input('program_id');
|
||||
$program = Program::find($programId);
|
||||
if (!$program) {
|
||||
abort(400, 'Program tidak ditemukan.');
|
||||
}
|
||||
} else {
|
||||
abort(400, 'Program tidak ditemukan.');
|
||||
}
|
||||
}
|
||||
|
||||
$validatedData = $request->validate([
|
||||
'nama' => ['required','string','max:255'],
|
||||
'tahun' => ['required','integer']
|
||||
]);
|
||||
$framework = Framework::create(
|
||||
[...$validatedData,
|
||||
'program_id' => $program->id,
|
||||
]
|
||||
);
|
||||
return redirect()->route('framework.index')->with('success', 'Data berhasil ditambahkan.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Request $request, string $id): View
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$framework = Framework::findOrFail($id);
|
||||
|
||||
return view('program.framework.view', compact('framework'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Request $request, string $id): View
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$framework = Framework::findOrFail($id);
|
||||
$program = Program::all();
|
||||
|
||||
return view('program.framework.edit', compact('framework', 'program'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id): RedirectResponse
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$framework = Framework::findOrFail($id);
|
||||
|
||||
if (app()->has('SystemProgram')) {
|
||||
$program = app('SystemProgram');
|
||||
} else {
|
||||
if ($request->has('program_id') && $request->input('program_id')) {
|
||||
$programId = $request->input('program_id');
|
||||
$program = Program::find($programId);
|
||||
if (!$program) {
|
||||
abort(400, 'Program tidak ditemukan.');
|
||||
}
|
||||
} else {
|
||||
abort(400, 'Program tidak ditemukan.');
|
||||
}
|
||||
}
|
||||
|
||||
$validatedData = $request->validate([
|
||||
'nama' => ['required','string','max:255'],
|
||||
'tahun' => ['required','integer']
|
||||
]);
|
||||
|
||||
$framework->update(
|
||||
[...$validatedData,
|
||||
'program_id' => $program->id,
|
||||
]
|
||||
);
|
||||
|
||||
return redirect()->route('framework.index')->with('success', 'Data berhasil diperbarui.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id): RedirectResponse
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$framework = Framework::findOrFail($id);
|
||||
$framework->delete();
|
||||
|
||||
return redirect()->route('framework.index')->with('success', 'Data berhasil dihapus.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Program;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
use App\Models\Program\Framework;
|
||||
use App\Models\Program\Transformasi;
|
||||
use App\Models\Program\Aktivitas;
|
||||
use App\Models\Program\Target;
|
||||
|
||||
class TargetController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
private function validated(Request $request) {
|
||||
return $request->validate([
|
||||
'variabel' => ['required','string','max:255'],
|
||||
'tipe' => ['required','string','max:255', Rule::in(['integer', 'float', 'boolean']),],
|
||||
'target_integer' => [
|
||||
Rule::requiredIf($request->tipe === 'integer'),
|
||||
'nullable',
|
||||
'integer'
|
||||
],
|
||||
'target_float' => [
|
||||
Rule::requiredIf($request->tipe === 'float'),
|
||||
'nullable',
|
||||
'numeric'
|
||||
],
|
||||
'target_boolean' => [
|
||||
Rule::requiredIf($request->tipe === 'boolean'),
|
||||
'nullable',
|
||||
'boolean'
|
||||
],
|
||||
'baseline_integer' => [
|
||||
Rule::requiredIf($request->tipe === 'integer'),
|
||||
'nullable',
|
||||
'integer'
|
||||
],
|
||||
'baseline_float' => [
|
||||
Rule::requiredIf($request->tipe === 'float'),
|
||||
'nullable',
|
||||
'numeric'
|
||||
],
|
||||
'baseline_boolean' => [
|
||||
Rule::requiredIf($request->tipe === 'boolean'),
|
||||
'nullable',
|
||||
'boolean'
|
||||
],
|
||||
'realisasi_integer' => [
|
||||
'nullable',
|
||||
'integer'
|
||||
],
|
||||
'realisasi_float' => [
|
||||
'nullable',
|
||||
'numeric'
|
||||
],
|
||||
'realisasi_boolean' => [
|
||||
'nullable',
|
||||
'boolean'
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function create(string $frameworkId, string $transformasiId, string $aktivitasId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request, string $frameworkId, string $transformasiId, string $aktivitasId): JsonResponse
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$aktivitas = Aktivitas::whereHas('transformasi', function ($query) use ($frameworkId) {
|
||||
$query->where('framework_id', $frameworkId);
|
||||
})->where('transformasi_id', $transformasiId)->find($aktivitasId);
|
||||
if (!$aktivitas) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data aktivitas tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$validated = $this->validated($request);
|
||||
Target::create([...$validated,
|
||||
'aktivitas_id' => $aktivitasId,
|
||||
'created_by' => auth()->id(),
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Target berhasil ditambahkan.'
|
||||
], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Program;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
use App\Models\Program\Framework;
|
||||
use App\Models\Program\Transformasi;
|
||||
|
||||
class TransformasiController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function store(Request $request, string $frameworkId): JsonResponse
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$framework = Framework::find($frameworkId);
|
||||
if (!$framework) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data kerangka kerja tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'kode' => ['required','string','max:255'],
|
||||
'nama' => ['required','string','max:255'],
|
||||
]);
|
||||
|
||||
Transformasi::create([...$validated,
|
||||
'framework_id' => $frameworkId,
|
||||
'created_by' => auth()->id(),
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Transformasi berhasil ditambahkan.'
|
||||
], 201);
|
||||
}
|
||||
|
||||
public function show(string $frameworkId, string $id)
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$transformasi = Transformasi::where('framework_id', $frameworkId)->find($id);
|
||||
if (!$transformasi) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data transformasi tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
return response()->json(['data' => $transformasi, 'status' => 'success']);
|
||||
}
|
||||
|
||||
public function edit(string $frameworkId, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function update(Request $request, string $frameworkId, string $id)
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$transformasi = Transformasi::where('framework_id', $frameworkId)->find($id);
|
||||
if (!$transformasi) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data transformasi tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'kode' => ['required','string','max:255'],
|
||||
'nama' => ['required','string','max:255'],
|
||||
]);
|
||||
|
||||
$transformasi->update([...$validated,
|
||||
'framework_id' => $frameworkId,
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Transformasi berhasil diperbarui.'
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function destroy(string $frameworkId, string $id)
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$transformasi = Transformasi::where('framework_id', $frameworkId)->find($id);
|
||||
if (!$transformasi) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Data transformasi tidak ditemukan.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$transformasi->delete();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Transformasi berhasil dihapus.'
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
@@ -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\Transformasi;
|
||||
use App\Models\Program\Target;
|
||||
|
||||
class Aktivitas extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'program_aktivitas';
|
||||
|
||||
protected $fillable = [
|
||||
"kode",
|
||||
"nama",
|
||||
"jenis_aktivitas",
|
||||
"indikator",
|
||||
"deskripsi",
|
||||
"transformasi_id",
|
||||
];
|
||||
|
||||
public function transformasi(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Transformasi::class, 'transformasi_id', 'id');
|
||||
}
|
||||
|
||||
public function target(): HasMany
|
||||
{
|
||||
return $this->hasMany(Target::class, 'aktivitas_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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\Core\Program;
|
||||
use App\Models\Program\Transformasi;
|
||||
|
||||
class Framework extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'program_framework';
|
||||
|
||||
protected $fillable = [
|
||||
"nama",
|
||||
"tahun",
|
||||
"program_id",
|
||||
];
|
||||
|
||||
public function program(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Program::class, 'program_id', 'id');
|
||||
}
|
||||
|
||||
public function transformasi(): HasMany
|
||||
{
|
||||
return $this->hasMany(Transformasi::class, 'framework_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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\Aktivitas;
|
||||
|
||||
class Target extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'program_target';
|
||||
|
||||
protected $fillable = [
|
||||
"variabel",
|
||||
"tipe",
|
||||
"target_integer",
|
||||
"target_float",
|
||||
"target_boolean",
|
||||
"baseline_integer",
|
||||
"baseline_float",
|
||||
"baseline_boolean",
|
||||
"realisasi_integer",
|
||||
"realisasi_float",
|
||||
"realisasi_boolean",
|
||||
"aktivitas_id",
|
||||
];
|
||||
|
||||
public function aktivitas(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Aktivitas::class, 'aktivitas_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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 aktivitas(): HasMany
|
||||
{
|
||||
return $this->hasMany(Aktivitas::class, 'transformasi_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user