Skip to content

Commit 8ee5a6c

Browse files
committed
Add Kerangka Acuan
1 parent e0da939 commit 8ee5a6c

File tree

7 files changed

+173
-2
lines changed

7 files changed

+173
-2
lines changed

.tinkerun/inspiring.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
// }
6161
// $b = nomor('2024','6',1,1,'B');
62-
User::cache()->get('all')->where('unit_kerja_id',1)->pluck('id')->toArray();
62+
User::cache()->get('all')->where('unit_kerja_id',null)->pluck('id')->toArray();
6363

6464

6565

app/Models/IzinKeluar.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
namespace App\Models;
44

5+
use App\Models\User;
56
use Illuminate\Database\Eloquent\Factories\HasFactory;
67
use Illuminate\Database\Eloquent\Model;
8+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
79
use Illuminate\Support\Facades\Auth;
810
use Laravel\Nova\Notifications\NovaNotification;
911
use Laravel\Nova\Nova;
@@ -16,6 +18,15 @@ class IzinKeluar extends Model
1618
protected $casts = [
1719
'tanggal' => 'date',
1820
];
21+
22+
/**
23+
* Get the post that owns the comment.
24+
*/
25+
public function user(): BelongsTo
26+
{
27+
return $this->belongsTo(User::class);
28+
}
29+
1930
/**
2031
* The "booted" method of the model.
2132
*/

app/Models/KerangkaAcuan.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class KerangkaAcuan extends Model
9+
{
10+
use HasFactory;
11+
protected $casts = [
12+
'tanggal' => 'date',
13+
'awal' => 'date',
14+
'akhir' => 'date',
15+
'spesifikasi' => 'array',
16+
'anggaran' => 'array',
17+
];
18+
}

app/Nova/IzinKeluar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
class IzinKeluar extends Resource
1616
{
17+
public static $with = ['user',];
1718
/**
1819
* Get the label for the resource.
1920
*

app/Nova/KerangkaAcuan.php

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?php
2+
3+
namespace App\Nova;
4+
5+
use Illuminate\Http\Request;
6+
use Laravel\Nova\Fields\ID;
7+
use Laravel\Nova\Http\Requests\NovaRequest;
8+
9+
class KerangkaAcuan extends Resource
10+
{
11+
/**
12+
* The model the resource corresponds to.
13+
*
14+
* @var class-string<\App\Models\KerangkaAcuan>
15+
*/
16+
public static $model = \App\Models\KerangkaAcuan::class;
17+
18+
/**
19+
* The single value that should be used to represent the resource when being displayed.
20+
*
21+
* @var string
22+
*/
23+
public static $title = 'id';
24+
25+
/**
26+
* The columns that should be searched.
27+
*
28+
* @var array
29+
*/
30+
public static $search = [
31+
'id',
32+
];
33+
34+
/**
35+
* Get the fields displayed by the resource.
36+
*
37+
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
38+
* @return array
39+
*/
40+
public function fields(NovaRequest $request)
41+
{
42+
return [
43+
ID::make()->sortable(),
44+
];
45+
}
46+
47+
/**
48+
* Get the cards available for the request.
49+
*
50+
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
51+
* @return array
52+
*/
53+
public function cards(NovaRequest $request)
54+
{
55+
return [];
56+
}
57+
58+
/**
59+
* Get the filters available for the resource.
60+
*
61+
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
62+
* @return array
63+
*/
64+
public function filters(NovaRequest $request)
65+
{
66+
return [];
67+
}
68+
69+
/**
70+
* Get the lenses available for the resource.
71+
*
72+
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
73+
* @return array
74+
*/
75+
public function lenses(NovaRequest $request)
76+
{
77+
return [];
78+
}
79+
80+
/**
81+
* Get the actions available for the resource.
82+
*
83+
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
84+
* @return array
85+
*/
86+
public function actions(NovaRequest $request)
87+
{
88+
return [];
89+
}
90+
}

app/Nova/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class User extends Resource
1616
{
17-
public static $with = ['unitKerja'];
17+
public static $with = ['unitKerja',];
1818

1919
/**
2020
* The model the resource corresponds to.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('kerangka_acuans', function (Blueprint $table) {
15+
$table->id();
16+
$table->date('tanggal')->nullable();
17+
$table->integer('no_urut')->nullable();
18+
$table->string('nomor')->unique()->nullable();
19+
$table->string('rincian')->nullable();
20+
$table->text('latar')->nullable();
21+
$table->text('maksud')->nullable();
22+
$table->text('tujuan')->nullable();
23+
$table->text('sasaran')->nullable();
24+
$table->string('tkdn', 5)->nullable();
25+
$table->string('jenis', 30)->nullable();
26+
$table->string('metode', 30)->nullable();
27+
$table->text('anggaran')->nullable();
28+
$table->text('spesifikasi')->nullable();
29+
$table->text('kegiatan')->nullable();
30+
$table->date('awal')->nullable();
31+
$table->date('akhir')->nullable();
32+
$table->string('nama')->nullable();
33+
$table->string('nip',30)->nullable();
34+
$table->string('jabatan',50)->nullable();
35+
$table->bigInteger('unit_kerja_id')->nullable()->unsigned();
36+
$table->string('ppk')->nullable();
37+
$table->string('nipppk',30)->nullable();
38+
$table->string('link')->nullable();
39+
$table->string('tahun', 4)->nullable();
40+
$table->timestamps();
41+
});
42+
}
43+
44+
/**
45+
* Reverse the migrations.
46+
*/
47+
public function down(): void
48+
{
49+
Schema::dropIfExists('kerangka_acuans');
50+
}
51+
};

0 commit comments

Comments
 (0)