Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Syafa Milati Azka
layanan-diskominfo
Commits
5c6a1d33
Commit
5c6a1d33
authored
1 month ago
by
Sekar Auvril Liura Ariesta
Browse files
Options
Download
Email Patches
Plain Diff
migrasi sm model superadmin, admin, bidang, opd
parent
7e5edfc8
sistem-keamanan-informasi
PPID
PPID-Test
assessment-subdomain
assessment-subdomain-auth
main
2 merge requests
!2
migrations table superadmin, admin, opd, dan bidang layanan
,
!1
migrations table superadmin, admin, opd, dan bidang layanan
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
backend/app/Models/Admin.php
+33
-1
backend/app/Models/Admin.php
backend/app/Models/BidangLayanan.php
+22
-1
backend/app/Models/BidangLayanan.php
backend/app/Models/Opd.php
+33
-1
backend/app/Models/Opd.php
backend/app/Models/Superadmin.php
+25
-1
backend/app/Models/Superadmin.php
backend/database/migrations/2025_04_29_130917_create_bidang_layanans_table.php
+1
-1
...ations/2025_04_29_130917_create_bidang_layanans_table.php
backend/database/migrations/2025_04_29_131135_create_superadmins_table.php
+3
-3
...migrations/2025_04_29_131135_create_superadmins_table.php
backend/database/migrations/2025_04_29_131155_create_opds_table.php
+1
-1
...tabase/migrations/2025_04_29_131155_create_opds_table.php
backend/database/migrations/2025_04_29_131209_create_admins_table.php
+6
-6
...base/migrations/2025_04_29_131209_create_admins_table.php
with
124 additions
and
15 deletions
+124
-15
backend/app/Models/Admin.php
View file @
5c6a1d33
...
...
@@ -3,8 +3,40 @@
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
class
Admin
extends
Model
{
//
use
HasFactory
;
protected
$fillable
=
[
'nip'
,
'id_opd'
,
'id_bidang'
,
'password'
,
'nama'
,
'email'
,
];
// admin n opd 1:1
public
function
opd
()
{
return
$this
->
belongsTo
(
Opd
::
class
,
'id_opd'
);
}
// admin membuat laporan monev 1:N
public
function
laporanMonev
()
{
return
$this
->
hasMany
(
LaporanMonev
::
class
);
}
// admin n bidang layanan 1:1
public
function
bidangLayanan
()
{
return
$this
->
belongsTo
(
BidangLayanan
::
class
,
'id_bidang'
);
}
}
This diff is collapsed.
Click to expand it.
backend/app/Models/BidangLayanan.php
View file @
5c6a1d33
...
...
@@ -2,9 +2,30 @@
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
class
BidangLayanan
extends
Model
{
//
use
HasFactory
;
protected
$fillable
=
[
'nama'
,
];
// superadmin n bidang layanan one to one kan?
public
function
superadmin
()
{
return
$this
->
hasOne
(
Superadmin
::
class
,
'id_superadmin'
);
}
// bidang n admin 1:1
public
function
admin
()
{
return
$this
->
hasOne
(
Admin
::
class
,
'id_admin'
);
}
}
This diff is collapsed.
Click to expand it.
backend/app/Models/Opd.php
View file @
5c6a1d33
...
...
@@ -2,9 +2,41 @@
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
class
Opd
extends
Model
{
//
use
HasFactory
;
protected
$fillable
=
[
'nama'
,
'alamat'
,
];
// opd n admin 1:1
public
function
admin
()
{
return
$this
->
hasOne
(
Admin
::
class
,
'id_admin'
);
}
// opd membuat pengajuan 1:N
public
function
pengajuan
()
{
return
$this
->
hasMany
(
Pengajuan
::
class
);
}
// opd mengikuti meeting monev 1:N
public
function
meetingMonev
()
{
return
$this
->
hasMany
(
MeetingMonev
::
class
);
}
// opd memiliki subdomain 1:N
public
function
subdomain
()
{
return
$this
->
hasMany
(
Subdomain
::
class
);
}
}
This diff is collapsed.
Click to expand it.
backend/app/Models/Superadmin.php
View file @
5c6a1d33
...
...
@@ -3,8 +3,32 @@
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
class
Superadmin
extends
Model
{
//
use
HasFactory
;
protected
$fillable
=
[
'nama'
,
'email'
,
'id_bidang'
,
'password'
,
];
// superadmin n bidang layanan
public
function
bidang
()
{
return
$this
->
belongsTo
(
BidangLayanan
::
class
,
'id_bidang'
);
}
// superadmin menjadwalkan assessment 1:N
public
function
assessment
()
{
return
$this
->
hasMany
(
Assessment
::
class
);
}
// superadmin menjadwalkan meeting monev 1:N
public
function
meetingMonev
()
{
return
$this
->
hasMany
(
MeetingMonev
::
class
);
}
}
This diff is collapsed.
Click to expand it.
backend/database/migrations/2025_04_29_130917_create_bidang_layanans_table.php
View file @
5c6a1d33
...
...
@@ -12,7 +12,7 @@ return new class extends Migration
public
function
up
():
void
{
Schema
::
create
(
'bidang_layanans'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
id
(
'id_bidang'
);
$table
->
string
(
'nama'
,
100
);
$table
->
timestamps
();
});
...
...
This diff is collapsed.
Click to expand it.
backend/database/migrations/2025_04_29_131135_create_superadmins_table.php
View file @
5c6a1d33
...
...
@@ -12,11 +12,11 @@ return new class extends Migration
public
function
up
():
void
{
Schema
::
create
(
'superadmins'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
id
(
'id_superadmin'
);
$table
->
string
(
'nama'
,
100
);
$table
->
string
(
'email'
,
100
)
->
unique
();
$table
->
unsignedBigInteger
(
'bidang
_id
'
);
$table
->
foreign
(
'bidang
_id
'
)
->
references
(
'id'
)
->
on
(
'bidang_layanans'
);
$table
->
unsignedBigInteger
(
'
id_
bidang'
);
$table
->
foreign
(
'
id_
bidang'
)
->
references
(
'id
_bidang
'
)
->
on
(
'bidang_layanans'
);
$table
->
string
(
'password'
,
100
);
$table
->
timestamps
();
});
...
...
This diff is collapsed.
Click to expand it.
backend/database/migrations/2025_04_29_131155_create_opds_table.php
View file @
5c6a1d33
...
...
@@ -12,7 +12,7 @@ return new class extends Migration
public
function
up
():
void
{
Schema
::
create
(
'opds'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
id
(
'id_opd'
);
$table
->
string
(
'nama'
,
100
);
$table
->
string
(
'alamat'
,
255
);
$table
->
timestamps
();
...
...
This diff is collapsed.
Click to expand it.
backend/database/migrations/2025_04_29_131209_create_admins_table.php
View file @
5c6a1d33
...
...
@@ -12,12 +12,12 @@ return new class extends Migration
public
function
up
():
void
{
Schema
::
create
(
'admins'
,
function
(
Blueprint
$table
)
{
//
$table->id();
$table
->
string
(
'nip'
,
30
)
->
primary
();
$table
->
unsignedBigInteger
(
'
opd_i
d'
);
$table
->
foreign
(
'
opd_i
d'
)
->
references
(
'id'
)
->
on
(
'opds'
);
$table
->
unsignedBigInteger
(
'bidang
_id
'
);
$table
->
foreign
(
'bidang
_id
'
)
->
references
(
'id'
)
->
on
(
'bidang_layanans'
);
$table
->
id
(
'id_admin'
);
$table
->
string
(
'nip'
,
30
)
->
unique
();
$table
->
unsignedBigInteger
(
'
id_op
d'
);
$table
->
foreign
(
'
id_op
d'
)
->
references
(
'id
_opd
'
)
->
on
(
'opds'
);
$table
->
unsignedBigInteger
(
'
id_
bidang'
);
$table
->
foreign
(
'
id_
bidang'
)
->
references
(
'id
_bidang
'
)
->
on
(
'bidang_layanans'
);
$table
->
string
(
'password'
,
100
);
$table
->
string
(
'nama'
,
100
);
$table
->
string
(
'email'
,
100
)
->
unique
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help