Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/Filament/Resources/TicketResource/Pages/ListTickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ protected function getActions(): array

protected function getTableQuery(): Builder
{
// 🔥 ATASAN: BISA LIHAT SEMUA TIKET
if (in_array(auth()->user()->name, ['Husnul Septia'])) {
return parent::getTableQuery()->orderBy('created_at', 'desc');
}

return parent::getTableQuery()
->where(function ($query) {
return $query->where('owner_id', auth()->user()->id)
Expand Down
14 changes: 14 additions & 0 deletions app/Policies/TicketPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class TicketPolicy
*/
public function viewAny(User $user)
{
// 🔥 ATASAN: BISA LIHAT SEMUA TIKET
if (in_array($user->name, [
'Husnul Septia',
])) {
return true;
}

return $user->can('List tickets');
}

Expand All @@ -30,6 +37,13 @@ public function viewAny(User $user)
*/
public function view(User $user, Ticket $ticket)
{
// 🔥 ATASAN: BISA LIHAT SEMUA TIKET
if (in_array($user->name, [
'Husnul Septia',
])) {
return true;
}

return $user->can('View ticket')
&& (
$ticket->owner_id === $user->id
Expand Down
Loading