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
18 changes: 15 additions & 3 deletions app/Filament/Resources/TokenResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@ class TokenResource extends Resource

protected static ?string $navigationIcon = 'heroicon-o-key';

// tambahkan ini supaya muncul di MANAGEMENT
protected static ?int $navigationSort = 5;
protected static ?string $navigationGroup = 'Management';
protected static ?string $navigationLabel = 'Tokens';

protected static function getNavigationLabel(): string
{
return __('Tokens');
}

public static function getPluralLabel(): ?string
{
return static::getNavigationLabel();
}

protected static function getNavigationGroup(): ?string
{
return __('Management');
}

public static function form(Form $form): Form
{
Expand Down
56 changes: 56 additions & 0 deletions app/Http/Controllers/Api/TicketController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace App\Http\Controllers\Api;

use App\Models\Ticket;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class TicketController extends Controller
{

/**
* Cek tiket berdasarkan ID numerik
*/
public function show($id)
{
$ticket = Ticket::with(['owner', 'status', 'project'])->find($id);

if (! $ticket) {
return response()->json([
'message' => 'Ticket not found',
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message should be localized to match the application's internationalization pattern, similar to how other messages use translation keys.

Suggested change
'message' => 'Ticket not found',
'message' => __('ticket.not_found'),

Copilot uses AI. Check for mistakes.
], 404);
}

return $this->formatTicketResponse($ticket);
}

/**
* Format response JSON untuk ticket
*/
protected function formatTicketResponse(Ticket $ticket)
{
$content = $ticket->content;

// Ganti <br> dan </p> jadi newline sebelum strip_tags
$content = preg_replace('/<br\s*\/?>/i', "\n", $content);
$content = preg_replace('/<\/p>/i', "\n", $content);

// Hapus semua tag HTML lain
$plainText = trim(strip_tags($content));

return response()->json([
'message' => 'Success',
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success message should be localized to maintain consistency with the application's internationalization approach.

Suggested change
'message' => 'Success',
'message' => __('Success'),

Copilot uses AI. Check for mistakes.
'data' => [
'tiket_id' => $ticket->id,
'tiket_code' => $ticket->code,
'tiket_status' => $ticket->status?->name,
'tiket_nama' => $ticket->name,
'tiket_layanan' => $ticket->project?->name,
'tiket_deskripsi' => $plainText,
'tiket_created_at' => $ticket->created_at?->format('Y-m-d H:i:s'),
'tiket_updated_at' => $ticket->updated_at?->format('Y-m-d H:i:s'),
],
]);
}
}
3 changes: 2 additions & 1 deletion lang/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,6 @@
"End year": "Tahun akhir",
"Month": "Bulan",
"Year": "Tahun",
"Data not found": "Data tidak ditemukan"
"Data not found": "Data tidak ditemukan",
"Tokens": "Token"
}
2 changes: 2 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@
// 'user' => $request->user(),
// ]);
// });

Route::middleware('auth:sanctum')->get('/ticket/id/{id}', [\App\Http\Controllers\Api\TicketController::class, 'show']);