Skip to content

Commit 6c6d663

Browse files
committed
2 parents 8ee5a6c + fc37910 commit 6c6d663

File tree

7 files changed

+54
-48
lines changed

7 files changed

+54
-48
lines changed

app/Nova/IzinKeluar.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,18 @@ public static function label()
5151
/**
5252
* Build an "index" query for the given resource.
5353
*
54-
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
5554
* @param \Illuminate\Database\Eloquent\Builder $query
5655
* @return \Illuminate\Database\Eloquent\Builder
5756
*/
5857
public static function indexQuery(NovaRequest $request, $query)
5958
{
60-
$users = User::cache()->get('all')->where('unit_kerja_id',$request->user()->unit_kerja_id)->pluck('id')->toArray();
61-
if (session('role') === 'anggota')
59+
$users = User::cache()->get('all')->where('unit_kerja_id', $request->user()->unit_kerja_id)->pluck('id')->toArray();
60+
if (session('role') === 'anggota') {
6261
return $query->where('user_id', $request->user()->id);
63-
if (session('role') === 'koordinator')
64-
return $query->whereIn('user_id', $users);
62+
}
63+
if (session('role') === 'koordinator') {
64+
return $query->whereIn('user_id', $users);
65+
}
6566
}
6667

6768
/**

app/Policies/IzinKeluarPolicy.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use App\Models\IzinKeluar;
66
use App\Models\User;
7-
use Illuminate\Auth\Access\Response;
87

98
class IzinKeluarPolicy
109
{
@@ -13,7 +12,7 @@ class IzinKeluarPolicy
1312
*/
1413
public function viewAny(): bool
1514
{
16-
return in_array(session('role'), ['kepala','anggota','koordinator']);
15+
return in_array(session('role'), ['kepala', 'anggota', 'koordinator']);
1716
}
1817

1918
/**
@@ -31,6 +30,7 @@ public function view(User $user, IzinKeluar $izinKeluar): bool
3130
if (session('role') === 'anggota') {
3231
return $allowedyear && ($user->id === $izinKeluar->user_id);
3332
}
33+
3434
return false;
3535
}
3636

@@ -39,7 +39,7 @@ public function view(User $user, IzinKeluar $izinKeluar): bool
3939
*/
4040
public function create(User $user): bool
4141
{
42-
return in_array(session('role'), ['kepala','anggota','koordinator']);
42+
return in_array(session('role'), ['kepala', 'anggota', 'koordinator']);
4343
}
4444

4545
/**
@@ -48,6 +48,7 @@ public function create(User $user): bool
4848
public function update(User $user, IzinKeluar $izinKeluar): bool
4949
{
5050
$allowedyear = ((session('year') == $izinKeluar->tahun));
51+
5152
return $allowedyear && ($user->id === $izinKeluar->user_id);
5253
}
5354

@@ -57,6 +58,7 @@ public function update(User $user, IzinKeluar $izinKeluar): bool
5758
public function delete(User $user, IzinKeluar $izinKeluar): bool
5859
{
5960
$allowedyear = ((session('year') == $izinKeluar->tahun));
61+
6062
return $allowedyear && ($user->id === $izinKeluar->user_id);
6163
}
6264

@@ -66,6 +68,7 @@ public function delete(User $user, IzinKeluar $izinKeluar): bool
6668
public function restore(User $user, IzinKeluar $izinKeluar): bool
6769
{
6870
$allowedyear = ((session('year') == $izinKeluar->tahun));
71+
6972
return $allowedyear && ($user->id === $izinKeluar->user_id);
7073
}
7174

@@ -75,6 +78,7 @@ public function restore(User $user, IzinKeluar $izinKeluar): bool
7578
public function forceDelete(User $user, IzinKeluar $izinKeluar): bool
7679
{
7780
$allowedyear = ((session('year') == $izinKeluar->tahun));
81+
7882
return $allowedyear && ($user->id === $izinKeluar->user_id);
7983
}
8084

@@ -84,6 +88,7 @@ public function forceDelete(User $user, IzinKeluar $izinKeluar): bool
8488
public function replicate(User $user, IzinKeluar $izinKeluar): bool
8589
{
8690
$allowedyear = ((session('year') == $izinKeluar->tahun));
91+
8792
return $allowedyear && ($user->id === $izinKeluar->user_id);
8893
}
8994
}

app/Policies/JenisNaskahPolicy.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,62 @@ class JenisNaskahPolicy
99
*/
1010
public function viewAny(): bool
1111
{
12-
return (session('role') === 'admin');
12+
return session('role') === 'admin';
1313
}
1414

1515
/**
1616
* Determine whether the user can view the model.
1717
*/
1818
public function view(): bool
1919
{
20-
return (session('role') === 'admin');
20+
return session('role') === 'admin';
2121
}
2222

2323
/**
2424
* Determine whether the user can create models.
2525
*/
2626
public function create(): bool
2727
{
28-
return (session('role') === 'admin');
28+
return session('role') === 'admin';
2929
}
3030

3131
/**
3232
* Determine whether the user can update the model.
3333
*/
3434
public function update(): bool
3535
{
36-
return (session('role') === 'admin');
36+
return session('role') === 'admin';
3737
}
3838

3939
/**
4040
* Determine whether the user can delete the model.
4141
*/
4242
public function delete(): bool
4343
{
44-
return (session('role') === 'admin');
44+
return session('role') === 'admin';
4545
}
4646

4747
/**
4848
* Determine whether the user can restore the model.
4949
*/
5050
public function restore(): bool
5151
{
52-
return (session('role') === 'admin');
52+
return session('role') === 'admin';
5353
}
5454

5555
/**
5656
* Determine whether the user can permanently delete the model.
5757
*/
5858
public function forceDelete(): bool
5959
{
60-
return (session('role') === 'admin');
60+
return session('role') === 'admin';
6161
}
6262

6363
/**
6464
* Determine whether the user can replicate the model.
6565
*/
6666
public function replicate(): bool
6767
{
68-
return (session('role') === 'admin');
68+
return session('role') === 'admin';
6969
}
7070
}

app/Policies/KodeArsipPolicy.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,62 @@ class KodeArsipPolicy
99
*/
1010
public function viewAny(): bool
1111
{
12-
return (session('role') === 'admin');
12+
return session('role') === 'admin';
1313
}
1414

1515
/**
1616
* Determine whether the user can view the model.
1717
*/
1818
public function view(): bool
1919
{
20-
return (session('role') === 'admin');
20+
return session('role') === 'admin';
2121
}
2222

2323
/**
2424
* Determine whether the user can create models.
2525
*/
2626
public function create(): bool
2727
{
28-
return (session('role') === 'admin');
28+
return session('role') === 'admin';
2929
}
3030

3131
/**
3232
* Determine whether the user can update the model.
3333
*/
3434
public function update(): bool
3535
{
36-
return (session('role') === 'admin');
36+
return session('role') === 'admin';
3737
}
3838

3939
/**
4040
* Determine whether the user can delete the model.
4141
*/
4242
public function delete(): bool
4343
{
44-
return (session('role') === 'admin');
44+
return session('role') === 'admin';
4545
}
4646

4747
/**
4848
* Determine whether the user can restore the model.
4949
*/
5050
public function restore(): bool
5151
{
52-
return (session('role') === 'admin');
52+
return session('role') === 'admin';
5353
}
5454

5555
/**
5656
* Determine whether the user can permanently delete the model.
5757
*/
5858
public function forceDelete(): bool
5959
{
60-
return (session('role') === 'admin');
60+
return session('role') === 'admin';
6161
}
6262

6363
/**
6464
* Determine whether the user can replicate the model.
6565
*/
6666
public function replicate(): bool
6767
{
68-
return (session('role') === 'admin');
68+
return session('role') === 'admin';
6969
}
7070
}

app/Policies/KodeNaskahPolicy.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,62 @@ class KodeNaskahPolicy
99
*/
1010
public function viewAny(): bool
1111
{
12-
return (session('role') === 'admin');
12+
return session('role') === 'admin';
1313
}
1414

1515
/**
1616
* Determine whether the user can view the model.
1717
*/
1818
public function view(): bool
1919
{
20-
return (session('role') === 'admin');
20+
return session('role') === 'admin';
2121
}
2222

2323
/**
2424
* Determine whether the user can create models.
2525
*/
2626
public function create(): bool
2727
{
28-
return (session('role') === 'admin');
28+
return session('role') === 'admin';
2929
}
3030

3131
/**
3232
* Determine whether the user can update the model.
3333
*/
3434
public function update(): bool
3535
{
36-
return (session('role') === 'admin');
36+
return session('role') === 'admin';
3737
}
3838

3939
/**
4040
* Determine whether the user can delete the model.
4141
*/
4242
public function delete(): bool
4343
{
44-
return (session('role') === 'admin');
44+
return session('role') === 'admin';
4545
}
4646

4747
/**
4848
* Determine whether the user can restore the model.
4949
*/
5050
public function restore(): bool
5151
{
52-
return (session('role') === 'admin');
52+
return session('role') === 'admin';
5353
}
5454

5555
/**
5656
* Determine whether the user can permanently delete the model.
5757
*/
5858
public function forceDelete(): bool
5959
{
60-
return (session('role') === 'admin');
60+
return session('role') === 'admin';
6161
}
6262

6363
/**
6464
* Determine whether the user can replicate the model.
6565
*/
6666
public function replicate(): bool
6767
{
68-
return (session('role') === 'admin');
68+
return session('role') === 'admin';
6969
}
7070
}

app/Policies/PengelolaPolicy.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,62 @@ class PengelolaPolicy
99
*/
1010
public function viewAny(): bool
1111
{
12-
return (session('role') === 'admin');
12+
return session('role') === 'admin';
1313
}
1414

1515
/**
1616
* Determine whether the user can view the model.
1717
*/
1818
public function view(): bool
1919
{
20-
return (session('role') === 'admin');
20+
return session('role') === 'admin';
2121
}
2222

2323
/**
2424
* Determine whether the user can create models.
2525
*/
2626
public function create(): bool
2727
{
28-
return (session('role') === 'admin');
28+
return session('role') === 'admin';
2929
}
3030

3131
/**
3232
* Determine whether the user can update the model.
3333
*/
3434
public function update(): bool
3535
{
36-
return (session('role') === 'admin');
36+
return session('role') === 'admin';
3737
}
3838

3939
/**
4040
* Determine whether the user can delete the model.
4141
*/
4242
public function delete(): bool
4343
{
44-
return (session('role') === 'admin');
44+
return session('role') === 'admin';
4545
}
4646

4747
/**
4848
* Determine whether the user can restore the model.
4949
*/
5050
public function restore(): bool
5151
{
52-
return (session('role') === 'admin');
52+
return session('role') === 'admin';
5353
}
5454

5555
/**
5656
* Determine whether the user can permanently delete the model.
5757
*/
5858
public function forceDelete(): bool
5959
{
60-
return (session('role') === 'admin');
60+
return session('role') === 'admin';
6161
}
6262

6363
/**
6464
* Determine whether the user can replicate the model.
6565
*/
6666
public function replicate(): bool
6767
{
68-
return (session('role') === 'admin');
68+
return session('role') === 'admin';
6969
}
7070
}

0 commit comments

Comments
 (0)